@resourcefulhumans/update-lambda-environment-config
v1.1.0
Published
A helper script to update lambda environment variables with the current version and deploy time
Downloads
1
Readme
update-lambda-environment-config
This script takes the output of aws lambda get-function-configuration
and returns an updated environment configuration string with added version, deployTime and node environment from environment variables.
Example
Given this is the configuration for your lambda:
{
"FunctionName": "myLambdaFunction",
…
"Environment": {
"Variables": {
"FOO": "BAR"
}
}
}
If called like this:
$ VERSION=1.2.3
$ DEPLOY_TIME=1234567890
$ NODE_ENV=production
$ VARS=`aws lambda get-function-configuration \
--function-name myLambdaFunction \
| ./node_modules/.bin/update-lambda-environment-config`
it sets $VARS
to this
FOO="BAR",VERSION="1.2.3",DEPLOY_TIME="1234567890",NODE_ENV="production"
which can be used for updating it via aws lambda update-function-configuration
:
aws lambda update-function-configuration \
--function-name "myLambdaFunction" \
--environment "Variables={$(VARS)}"
See it in action here.