https://prefect.io logo
r

Robin

09/07/2020, 12:50 PM
Hey all, I am having the
Unexpected error: NoRegionError('You must specify a region.')
, although I added
AWS_DEFAULT_REGION
(along with
AWS_CREDENTIALS
) to the prefect secrets. Do I miss anything?
n

nicholas

09/07/2020, 3:51 PM
Hi @Robin - try setting your default region in
~/.aws/config
like this:
Copy code
[default]
region=us-east-1
r

Robin

09/07/2020, 3:53 PM
Hmm, I have done this already successfully to run flows locally. However, I want to avoid having to set this, such that the credentials and regions are loaded correctly in any environment and agent.
n

nicholas

09/07/2020, 3:57 PM
Got it @Robin - in which case take a look at the boto3 documentation regarding runtime configuration, since all the Prefect AWS tasks are based on the boto3 client.
r

Robin

09/07/2020, 4:40 PM
Thanks, I already looked into it and tried to solve it using the environment variable
AWS_DEFAULT_REGION
. Therefore, I set
os.environ['AWS_DEFAULT_REGION'] = 'eu-central-1'
in the flow, but it did not work. Do I need to set it in a task instead? Is there a common way of setting environment variables in prefect flows?
PS: Locally it worked fine to set the environment variable as described above, however, in the cloud it doesn't work. @Kyle Moon-Wright @nicholas
I created this merge request which solves the problem (locally) by adding kwargs to the run method and calling the AWS secrets manager with
region_name='eu-central-1'
. Does that approach make sense?
n

nicholas

09/08/2020, 1:42 PM
Hi @Robin sorry for the slow reply, yesterday was a holiday for us. The Core team will take a look at your PR asap!
🙏 1
r

Robin

09/08/2020, 2:02 PM
OK, well deserved! was already wondering (and feeling a bit neglected 😄 ) as you usually answer super fast 🙂
😄 1