A simple project demonstrating how to manage and use Lambda environment variables.
Check out the scripts
section of package.json
for details on what individual commands are doing, and Managing Lambda Versions Tutorial for more information on what is happening under the hood.
To try it out, run:
npm install
to fetch the dependenciesnpm run create
to create thedevelopment
version with some stage variablesnpm run check-dev
to execute thedevelopment
version of the Lambda function and print out the variablesnpm run set-production
to create aproduction
version from the current code, and changed the variable namenpm run check-production
to execute theproduction
version and print out the names. Note that the PROGRESS variable was removed because it was not specified in the previous update.npm run check-dev
to execute thedevelopment
version of the Lambda function and print out the variables. Note that the old values are still there, asdevelopment
is pointing to an older versionnpm run reassign-dev
to reassign the development alias to the latest version without changing any vars.npm run check-dev
to execute thedevelopment
version of the Lambda function and print out the variables. Note that the new values from production are now used.dev
andproduction
are pointing to the same numerical version, and the last update did not change any variables.npm run update
to update the development version and another variable namenpm run check-dev
to execute thedevelopment
version of the Lambda function and print out the variablesnpm run load-from-json
to load both variables into thedevelopment
aliasnpm run check-dev
to execute thedevelopment
version of the Lambda function and print out the variablesnpm run check-production
to see the old values in theproduction
environment. Note that they are unchanged.