Articles → AWS → Environment Variables In Lambda Function

Environment Variables In Lambda Function






What Are Environment Variables?


  1. An environment variable is the key-value pair
  2. An environment variable can be set from outside the application
  3. "PATH" is an example of an environment variable

Steps




  1. Create a lambda function
  2. Add an environment variable in the lambda function
  3. Use the environment variable in the code



Create A Lambda Function





Add An Environment Variable In The Lambda Function




Picture showing the Environment variable tab in the lambda function

Click to Enlarge



Picture showing the Environment variable section in edit mode

Click to Enlarge



Picture showing adding the Environment variable in lambda function

Click to Enlarge


Use The Environment Variable In The Code




process.env.<ENVIRONMENT_VARIABLE>


Picture showing using the Environment variable inside the code in the lambda function

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, January 18, 2022

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250