If you want to get the values of Environment Variables in AWS Lambda using Node.js runtime follow the instructions below.
Node.js Code to Access Environment Variables
const environmentVariable = process.env.ENVIRONMENT_VARIABLE
Let’s say that my environment variable has a name of
Continue reading Access AWS Lambda Environment Variables using Node.js
DB_USER, I will use the code below to get its value.
Editing configuration values inside the code is a high risk for error since there is a high chance that not only the values that you are changing you will change, you might even delete a letter or edit a line. In order to avoid this risk, you want your code to be able to accept configuration values at run time. This is extremely useful when developing codes on different environments like development, testing and production.
With AWS Lambda you can reuse your code on different environments using the Environment Variables.
Below is the way to use Environment Variables on AWS Lambda Console using Python 3.6.
Note: This is the same way to use Environment Variables on Python 2.7 and Python 3.7.
Environment Variables Setup
The Environment Variables section can be found under the Function Code section.
Environment Variables are Key/Value Pairs. The Key is what you will use on your Lambda Code, to access its Value. Continue reading AWS Lambda Console: Accessing Environment Variables via Python