There was an error while loading. Please reload this page.
How do I use KMS encrypted environment variables?
Create a package.json with the following variables static values:
{ "env": { "DBPassword_kms": "yourEncryptedPasswordHere", "DBUsername": "yourDatabaseUsername" } }
For calculated or dynamic values
For deployment: package.json with the following variables:
{ "env": { "DBPassword_kms": "${cloudformationPasswordParameter}", "DBUsername": "${cloudformationUsername}" } }
For testing locally: bot_dir/test/process.json:
Use the variables
To use the value in your Lambda function:
exports.handler = function(event, context, callback) { console.log("Username:", process.env.DBUsername); console.log("Decrypted value:", process.env.DBPassword_kms); callback(); }