Skip to content
This repository was archived by the owner on Jun 17, 2018. It is now read-only.

A helper script to update lambda environment variables with the current version and deploy time

License

Notifications You must be signed in to change notification settings

RHeactorJS/update-lambda-environment-config

Repository files navigation

update-lambda-environment-config

npm version Build Status Greenkeeper badge 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.

About

A helper script to update lambda environment variables with the current version and deploy time

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •