Flyway cannot find AWS Credentials Chain

Hi all,

A developer has been having issues relating to AWS integration with Flyway. Upon trying to grab migrations from an S3 bucket, the program fails, stating that it cannot find the AWS region associated with the credentials chain. Their AWS setup is the same as everyone elses', with the region set in .aws/config. The command aws configure get region succeeds, returning us-east-1. Upon setting AWS_REGION explicitly as a environment variable, the migrations continue to fail as its missing the AWS_CONTAINER_RELATIVE_URI and a few other critical AWS keys. All other AWS integrations work. At this point we are unsure of whether or not this is a configuration issue, or a bug in Flyway. No other developer with this setup has this issue.

Selected debugging from Maven, on repair.

[INFO] Flyway Community Edition 9.21.1 by Redgate
[INFO] See release notes here:
[DEBUG] AWS SDK available: true
[DEBUG] Unable to load region from to load region from system settings. Region must be specified either via environment variable (AWS_REGION) or  system property (aws.region).
[DEBUG] Unable to load region from region provided in profile: default
[DEBUG] Unable to load region from to contact EC2 metadata service.
[DEBUG] Unable to load config file: C:\Users\xxx\flyway.conf
[DEBUG] Unable to load config file: C:\work\trunk\ekotrope-migrations\flyway.conf
[DEBUG] Scanning for classpath resources at 'classpath:db/callback' ...
[DEBUG] Determining location urls for classpath:db/callback using ClassLoader ClassRealm[plugin>org.flywaydb:flyway-maven-plugin:9.21.1, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@30946e09] ...
[DEBUG] Unable to resolve location classpath:db/callback.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.886 s
[INFO] Finished at: 2024-02-15T14:16:55-05:00

Any help would be appreciated.




  • Hi @eko_joseph,

    May I know whether below profile is included in your `.aws/config` file? 

    region = your_aws_region
  • eko_josepheko_joseph Posts: 3 New member
    Yup. When we run aws configure, it creates a profile exactly like that, with a bit more information. We ran a code snippet to make sure our AWS SDK configuration was correct.

    import com.amazonaws.regions.AwsProfileRegionProvider;
    public class Scratch {
    public static void main(String[] args) {
    System.out.println(new AwsProfileRegionProvider().getRegion());
    } }

    Execution of this program in our development environment results in "us-east-1." The developer still cannot run migrations that use AWS functionality in Flyway.

  • Hi @eko_joseph,

    Many thanks for the feedback. 

    In the log, we see the debug message "Unable to load region from region provided in profile: default", which comes from the aws sdk. 

    It looks like the AwsProfileRegionProvider cannot find the `default` sector in the config file, which is confusing. 

    Can other parameters in the config file be loaded and applied properly? 

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file