To get the AWS Region where your Lambda Function is running you will need to import the os
module.
import os
Then from the os
module, you need to get the value of AWS_REGION
from the environ
mapping variable. This will return the AWS Region where the Lambda Function is running.
runtime_region = os.environ['AWS_REGION']
Note: The way of getting the Runtime AWS Region of your Lambda Function is the same as when you get a Lambda Environment Variable.
Continue reading How to Get Lambda Runtime Region via Python