Robin

    Robin

    2 years ago
    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?
    nicholas

    nicholas

    2 years ago
    Hi @Robin - try setting your default region in
    ~/.aws/config
    like this:
    [default]
    region=us-east-1
    Robin

    Robin

    2 years ago
    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.
    nicholas

    nicholas

    2 years ago
    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.
    Robin

    Robin

    2 years ago
    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?
    nicholas

    nicholas

    2 years ago
    Hi @Robin sorry for the slow reply, yesterday was a holiday for us. The Core team will take a look at your PR asap!
    Robin

    Robin

    2 years ago
    OK, well deserved! was already wondering (and feeling a bit neglected 😄 ) as you usually answer super fast 🙂