Aws-cli: 'cloudformation deploy' fails with S3 error

Created on 19 Sep 2019  路  3Comments  路  Source: aws/aws-cli

Hello everyone.

I am working with CloudFormation in multiple regions. The process used to be pretty straight forward:

  1. Create a S3 bucket
    -> aws s3 mb s3://my-stack-cft --profile region-1
  2. Package the templates
    -> aws cloudformation package --profile region-1 --template-file my-stack.yaml --s3-bucket my-stack-cft --output-template-file my-stack.packed.yaml
  3. Deploy the templates to multiple regions
    -> aws cloudformation deploy --profile region-1 --template-file my-stack.packed.yaml --stack-name my-stack
    -> aws cloudformation deploy --profile region-2 --template-file my-stack.packed.yaml --stack-name my-stack
    -> ...

This worked flawlessly, until now. When I tried to update the stack in a region, the deploy command failed with the message:

An error occurred (ValidationError) when calling the CreateChangeSet operation: S3 error: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.

Some debugging and it turned out that aws cloudformation deploy now seems to be unable to access CloudFormation Templates that have been uploaded by aws cloudformation package into a bucket "in a different region" (even though there shouldn't be anything like "a different region" for buckets).

Creating new buckets in all regions and uploading the templates to all of them solved the Issue but leaves a very bad taste since now all regions have to be kept in sync.

Question now is: Is this behavior intended and if so, is there any better solution (e.g. additional S3 bucket config) that restores the old behavior?

bug cloudformation packagdeploy customization

Most helpful comment

+1

All 3 comments

+1

Still nothing?

Hi @Jarodiv @tianmarin @felipeloha, I apologize for the delay. I think this is due to this feature needing to use the newer virtual-hosted-style S3 endpoints.

https://aws.amazon.com/blogs/infrastructure-and-automation/best-practices-for-using-amazon-s3-endpoints-in-aws-cloudformation-templates/

Marking as a bug.

Was this page helpful?
0 / 5 - 0 ratings