How can I get the region in which the current Glue job is executing?
When the Glue job starts executing, I see the output
Detected region eu-central-1
.
In AWS Lambda, I can use the following lines to fetch the current region:
import os
region = os.environ['AWS_REGION']
However, it seems like the AWS_REGION
environment variable is not present in Glue and therefore a KeyError
is raised:
KeyError: 'AWS_REGION'
The reason why I need the region is I am trying to fetch all databases and tables as described in this question and I do not want to hard code the region when creating the boto client.