Skip to content

Conversation

@EvanBrown96
Copy link

We ran into an issue with too many Session objects being created, and pulling AIMS credentials from SSM every time. This change adds caching for parameters pulled from SSM and values pulled from datadog.


self._setup_aws_resources(source)

def get(self, key, default=None, format='decoded', type=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should be get_from_dynamodb, and the other should be get_from_ssm - as it's not clear just looking at

self._access_key_id = env.get_parameter('access_key_id', decrypt=True)
self._secret_key = env.get_parameter('secret_access_key', decrypt=True)
except Exception as e:
logger.debug(f"Did not initialise aims credentials via SSM for {self._service_name} because {e}")
if self._access_key_id is None or self._secret_key is None:
try:
# if that doesn't work, attempt dynamodb
env = AlEnv(self._service_name, "aims_authc", "dynamodb")
self._access_key_id = env.get('access_key_id')
self._secret_key = env.get('secret_access_key')
why one uses env.get and one uses env.get_parameter


def _make_ssm_key(self, option_key):
return f"/deployments/{self.stack_name}/{self._get_region()}/env-settings/{self.application_name}/{self._make_client_option_key(option_key)}"
return f"/deployments/{self._get_stack_name()}/{self._get_region()}/env-settings/{self.application_name}/{self._make_client_option_key(option_key)}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding to https://github.com/alertlogic/alertlogic-sdk-python#readme the paths we search for in dynamodb / ssm.

Also, it's probably future work, but it would be nice to be able to specify those paths in ~/.alertlogic/config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants