1.0.0 • Published 7 years ago

@rheactorjs/update-lambda-environment-config v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

update-lambda-environment-config

npm version Build Status monitored by greenkeeper.io js-standard-style semantic-release

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.