awslabs / awslabs/aws-solutions-constructs
AWS Lambda with environment variables injected from SecretsManager
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 268
- Avg merge
- 5h 18m
- Merged PRs (30d)
- 5
Description
I'm looking for a construct that sets up a lambda function with secrets before the lambda gets invoked.
Something a la https://github.com/aws-samples/aws-lambda-environmental-variables-from-aws-secrets-manager
### Use Case
In nodejs, it's a hassle to move variables into secrets when you can only load secrets async. Top level await isn't straightforward either because web frameworks may bundle the server files into a single file and I don't have full control over which file appears first.
### Proposed Solution
I'd like my secrets to be injected as env vars when the lambda is invoked. Preferably they'd only get loaded from SecretsManager on cold starts, and cached. It'd use a lambda layer like described in this https://github.com/aws-samples/aws-lambda-environmental-variables-from-aws-secrets-manager
### Other
* [ ] :wave: I may be able to implement this feature request
* [ ] :warning: This feature might incur a breaking change
---
This is a :rocket: Feature Request
Contributor guide
Research direction
Start by reviewing the linked AWS sample for Lambda environment variables from Secrets Manager and compare it with the repository's existing Lambda and Secrets Manager patterns. Define the construct's scope, cold-start caching behavior, layer integration, permissions, and configuration before identifying implementation and test entry points; done means the proposed construct injects the requested secrets as environment variables on invocation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, node.js, typescript
- Domain
- backend, cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100