S3 bucket cannot be created if region is set
See original GitHub issueI’m trying to get Lambda@Edge working with Cloudfront in CDK. To make things easy, I was hoping that I could override my default region (us-west-2
) for my whole stack so that the Lambda would be deployed in us-east-1
, as required by Lambda@Edge functions.
However, when I set the region as a prop
, the S3 bucket creation fails with status code 400.
If I remove the region
property, the bucket is created without a problem.
Reproduction Steps
export abstract class ExampleStack extends Stack {
constructor(scope: Construct, id: string, props) {
super(scope, id, {
env: {
region: "us-east-1",
},
});
new Bucket(this, "MyBucket", {
bucketName: 'somesuch-bucket-foobar',
}
}
}
Error Log
1/3 | 3:21:58 PM | CREATE_FAILED | AWS::S3::Bucket | Bucket (Bucket83908E77) Bad Request (Service: Amazon S3; Status Code: 400; Error Code: 400 Bad Request; Request ID: 0FB9C10A83924370; S3 Extended Request ID: Vr8/8sYPDksJgYQ1IaFbpAA32xHSCohJnyXGoVjAOo1Z6gsQ5eHGNmQ06sEfsi6WaC3Y/1IcNfo=)
Environment
- CLI Version : 1.27.0 (build a98c0b3)
- Framework Version: 1.27.0
- OS : macOS
- Language : en-us
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Cannot create Amazon S3 Bucket in specified region
when calling the CreateBucket operation: A conflicting conditional operation is currently in progress against this resource.
Read more >Buckets overview - Amazon Simple Storage Service
Amazon S3 supports global buckets, which means that each bucket name must be unique across all AWS accounts in all the AWS Regions...
Read more >Amazon S3 Bucket region and name restrictions and ...
When creating the S3 bucket name you will be required to select "US East (N. Virginia)" for the region name. The reason that...
Read more >How to transfer my Amazon S3 Bucket to another region
But what you can do is, create another bucket in the new region and use Cross Region Replication(CRR) to transfer files from the...
Read more >What is Amazon S3 bucket? | Definition from TechTarget
An Amazon S3 bucket is a public cloud storage resource available in Amazon Web Services' (AWS) Simple Storage Service (S3), an object storage...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @iliapolo - thanks for checking back in. Yep, I think we’re good to close this.
For future travelers, if you run into this, a few things to try:
Are you trying to recreate an s3 bucket in a new region, after you deleted a bucket with the same name from another region? If so, that can cause the 400 status code. I couldn’t find official documentation on this, but it seems like the name is “released” for the bucket to be recreated in a new region 24 hours after it’s deleted in the old region.
From the docs, it looks like you should pass the account number and and the region if you try to specify a region in the
env
param.Same here, I had the exact same experience as @J-Swift. I spent 2 hours try to debug this. Perhaps if the error message could be included instead of just the code this would be easier to debug.