This Serverless Framework Plugin allows to use plain JSON files in remote locations being parsed as environment variables in lambda, this unlocks ability to do integrations with anothers services and/or SSM ParameterStore to save many environment variables in a single parameters key as a JSON.
Run serverless plugin install
in your Serverless project.
serverless plugin install -n serverless-remote-json-envs
Define YAML configuration within custom block as:
SSM
[...] [...] custom: RemoteJSONEnvs: provider: aws: SSMParameterStore: - key: /my/secret/one secretJSONKey: 'secretos' - key: /my/secret/two secretJSONKey: 'secrets' - key: /my/secret/three secretJSONKey: 'secrets' [...] [...]
S3
[...] [...] custom: RemoteJSONEnvs: provider: aws: S3: - key: mybucketname/myenvsfile.json secretJSONKey: 'secretos' [...] [...]
You can add as many keys as you need
secretJSONKey: is the root JSON key where you secrets are stored inside your JSON file E.G:
{ "secrets":{ "ENVIRONTMENT":"lifeisgood", "MICROSERVICE_URL":"MICROSERVICE_URL.serverless.com", "RATE_LIMIT":"420" } }
Lambda envs will end up like this:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4