AWS Lambda Environment Variables are a useful way to input configuration values to your AWS Lambda runtime. Especially, when there are configurations that are different in your Development environment compared to your Production environment. Like name of DynamoDB tables or MySQL databases.
Below we discuss how we can retrieve the values of Environment Variables in AWS Lambda using Ruby.
Ruby Code to Access Environment Variables
The code for accessing Environment Variables on AWS Lambda is just the same code for accessing environment variables in your local computer or server.
Here is the code to access environment variables using Ruby.
env_var = ENV['ENVIRONMENT_VARIABLE']
If we want to get the value of an environment variable with the key of DB_HOST then we will use the code below.
I have experienced that when I did the normal steps in installing terraform, the Command Prompt, PowerShell, and Git Bash still did not recognize the terraform command in Windows 11. Even when I already added the terraform.exe location in the Path Environment Variable.
It is just annoying when this happens, luckily I was able to resolve this issue.
Note: The instructions are for Windows 11, but these steps will also work in Windows 10.
I have been using Terraform for a while to launch my infrastructure in AWS, Google Cloud, and Azure and I am loving it since I do not need to learn different sets of languages or syntax for different Cloud Providers.
My only challenge when it comes to Terraform is that the installation instruction in the terraform site is not as detailed as I want it to be.
So here’s a tutorial on how to install Terraform in Windows 11 and make it work in Command Prompt, Powershell, and Git Bash with instructions and screenshots you can follow.
Note: You can also follow these steps for Windows 10.