I currently have a lambda that reads from my DynamoDB and S3, where I pass in us-east-1 as the region. I am now deploying a backup region as well, but I am not sure how to make the region variable in my lambda based on whether it's in the default region or warm/backup region. Is there a way to detect what region my lambda is running on, whether in Terraform where I have my lambda set up or anywhere else?
CodePudding user response:
Out of the box, Lambda functions have access to various environment variables, including:
- AWS_REGION
- AWS_LAMBDA_FUNCTION_NAME
- AWS_LAMBDA_LOG_GROUP_NAME
- AWS_LAMBDA_LOG_STREAM_NAME