-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add caching for ssm parameters and datadog values #124
base: master
Are you sure you want to change the base?
add caching for ssm parameters and datadog values #124
Conversation
else: | ||
raise AlEnvException() from e | ||
|
||
self._setup_aws_resources(source) | ||
|
||
def get(self, key, default=None, format='decoded', type=None): |
There was a problem hiding this comment.
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
alertlogic-sdk-python/almdrlib/config.py
Lines 119 to 128 in 6f49dbf
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') |
|
||
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)}" |
There was a problem hiding this comment.
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
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.