Closed postfalk closed 1 year ago
Why does it have this path names that just get chopped off. Couldn't we just store the plain key in that dic?
Mind elaborating on the path names getting chopped off questions?
Well put that in the wrong issue, never mind.
Oh, no I didn't. I am a little bit overwhelmed currently. Ok, here is the example:
Why do we have
SSM_NAMES = {
'ANIML_API_URL': f'/api/url-{config.STAGE}',
'BATCH_QUEUE': f'/images/batch-queue-{config.STAGE}',
'BATCH_JOB': f'/images/batch-job-{config.STAGE}',
'ARCHIVE_BUCKET': f'/images/archive-bucket-{config.STAGE}',
'SERVING_BUCKET': f'/images/serving-bucket-{config.STAGE}',
'DEADLETTER_BUCKET': f'/images/dead-letter-bucket-{config.STAGE}'}
Just to do
param_name = value.split("/")[-1]
further down? Could just be
SSM_NAMES = {
'ANIML_API_URL': f'url-{config.STAGE}',
'BATCH_QUEUE': f'batch-queue-{config.STAGE}',
'BATCH_JOB': f'batch-job-{config.STAGE}',
'ARCHIVE_BUCKET': f'archive-bucket-{config.STAGE}',
'SERVING_BUCKET': f'serving-bucket-{config.STAGE}',
'DEADLETTER_BUCKET': f'dead-letter-bucket-{config.STAGE}'}
We are not using this anywhere else. And if we were to I would think constructing these path names would be better than deconstructing them.
Do you have access to the Animl AWS account? If you do, check out the Systems Manger > Parameter Store (SSM) values. We use the "paths" just for organizational purposes b/c there are a lot of params in there and a bunch of the other animl services/repos draw from them too (that's a recommended best practice I read about in the AWS docs).
Your question about why we chop off the path is a good one though and I had to look into it to refresh my memory - it's because the Python lambda-cache utility we use stores the name of the parameter as the string after the last slash('/') character of its name (see "Change cache entry settings" section of the lambda-cache docs for more on that). I'm not totally sure why it does that but it's the default behavior.
Does that answer your question?
Thank you!