2021年4月2日星期五

Generate files from SSM parameters and include in Serverless Framework lambda bundle

I have some JSON stored in SSM Parameter Store that I would like to use in my Serverless Framework lambda functions (contains some details about infrastructure generated earlier by Terraform). I can make a call to SSM to get the data at runtime, but Parameter Store has very low throughput limits (40tps by default) so I would likely exceed that almost immediately, and even the higher limits are still far too low to be doing this in production.

More generally, I would like to avoid the overhead of calling external services to retrieve this information, as it will be used in a custom lambda authorizer, so I want it to be fast and not rely on any external dependencies where possible.

I was thinking of retrieving the JSON from Parameter Store and baking it in to my lambda bundle when I do a serverless deploy. I'm happy with the tradeoff of having to re-deploy my backend to when they change.

I could use environment variables, but the maximum size of all environment variables is 4kb, so I can't be putting JSON in there.

I'm using the Serverless Webpack Plugin, which I think might hold the key, but I'm a Webpack novice, and not sure where to start!

https://stackoverflow.com/questions/66922651/generate-files-from-ssm-parameters-and-include-in-serverless-framework-lambda-bu April 03, 2021 at 12:56AM

没有评论:

发表评论