[PYTHON] Get the region where AWS Lambda is running

Since the region is set in the environment variable ʻAWS_DEFAULT_REGION`, you can get it by accessing the environment variable in your language. In python, it looks like this:

import os
def lambda_handler(event, context):
    print "REGION:" + os.getenv("AWS_DEFAULT_REGION")

You can check other environment variables that can be used from here.

Recommended Posts

Get the region where AWS Lambda is running
[Introduction to AWS] The first Lambda is Transcribe ♪
I want to get the path of the directory where the running file is stored.
The simplest AWS Lambda implementation
Automatically get the port where Arduino is stuck in Python
Get the class name where the method is defined in the decorator
Where is the python instantiation process written?
[AWS] Addressing an issue where Lambda called from CodePipeline is still in progress
Get the latest AMI information with the AWS CLI
To get the path of the currently running python.exe
Get the location of the file where the exe is placed when the exe created by PyInstaller is executed
Around the place where the value of Errbot is stored
Get the absolute path of the script you are running
I tried running TensorFlow in AWS Lambda environment: Preparation
I tried to get an AMI using AWS Lambda
How to get the information of organizations, Cost Explorer of another AWS account with Lambda (python)