Elastic Beanstalk Deployment Error: "S3 client configured for “eu-west-2” but the bucket “elasticbeanstalk-eu-west-2-364597724349” is in “eu-west-2”"

Hey there! :wave:

I am getting the following error when deploying my app to Elastic Beanstalk:

Deploying application
S3 client configured for "eu-west-2" but the bucket "elasticbeanstalk-eu-west-2-364597724349" is in "eu-west-2"; Please configure the proper region to avoid multiple unnecessary redirects and signing attempts
/home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.302/lib/aws-sdk-resources/resource.rb:134:in `rescue in exists?': Aws::S3::Errors::BadRequest
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.302/lib/aws-sdk-resources/resource.rb:130:in `exists?'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-elastic_beanstalk-1.10.11/lib/dpl/provider/elastic_beanstalk.rb:101:in `bucket_exists?'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-elastic_beanstalk-1.10.11/lib/dpl/provider/elastic_beanstalk.rb:41:in `push_app'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/lib/dpl/provider.rb:199:in `block in deploy'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/lib/dpl/cli.rb:41:in `fold'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/lib/dpl/provider.rb:199:in `deploy'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/lib/dpl/cli.rb:32:in `run'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/lib/dpl/cli.rb:7:in `run'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/bin/dpl:5:in `<top (required)>'
	from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `load'
	from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `<main>'
failed to deploy

I suspect the error is here:

S3 client configured for “eu-west-2” but the bucket “elasticbeanstalk-eu-west-2-364597724349” is in “eu-west-2”; Please configure the proper region to avoid multiple unnecessary redirects and signing attempts

But does it really make sense?
Is there any way to fix this?

P.S.: For the @Travis-CI-Staff, the repo is at https://travis-ci.com/Kodular/Kodular-Auth

I am getting the same error. Did you find a solution?

I cannot really say how I fixed it, because I archived the repo that was causing the error and then created a new one. And now it is working in the new one. The .travis.yml files:

Working / New Repo

deploy:
  - skip_cleanup: true
    provider: elasticbeanstalk
    access_key_id: "$ACCESSKEYID"
    secret_access_key: "$SECRETACCESSKEY"
    region: "eu-west-2"
    app: "kodular-auth"
    env: "auth-dev"
    bucket_name: "..."
    zip_file: ".elasticbeanstalk/ebdeploy.zip"
    on:
      branch: master

Not Working / Old Repo

deploy:
  - provider: elasticbeanstalk
    skip_cleanup: true
    access_key_id: 
      secure: "..."
    secret_access_key:
      secure: "..."
    region: "eu-west-2"  
    app: "kodular-auth"
    env: "master"
    bucket_name: "..."
    zip_file: "ebdeploy.sh"
    on:
      repo: Kodular/Kodular-Auth
      branch: master

Note that ... was removed to not expose it. You should change those ... to the literal values.

Maybe the error was been caused because of using the secure way in the acess keys. It’s the only difference I can find. Try using environment variables and passing them with $ACCESSKEYID.

1 Like

I can’t see the OP’s project since it’s private, and @prowave didn’t provide anything to work with, either.

I suspect that there are some extraneous symbols in the zone configuration setting (perhaps resuling from YAML parsing) that you cannot see in the error message.

Quoting the setting string should help if this is the case. You can also use https://config.travis-ci.com/explore to see what exactly your .travis.yml is being parsed into.