Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'eu-central-1'

using Node.JS with the following config file

{ "accessKeyId" :"XXX", "secretAccessKey" :"XXXX", "region": "eu-central-1", "signatureVersion": "v4" }

I still receive this error message as if the aws sdk tries to access a us-east-1 region .

Any idea ?

like image 707
user1709062 Avatar asked Nov 24 '25 22:11

user1709062


2 Answers

According to AWS, there are three situations this can happen.

  1. When you are creating a bucket with a name that this already being used as a bucket name in your AWS account or in any other AWS account (Please note that S3 bucket names are globally unique).

  2. When you are doing an operation on your S3 bucket and you have set the Region variable (either when configuring the SDK or while using environment variables etc) to a region other than the one in which the bucket is actually present.

  3. You have recently deleted a S3 bucket in a particular region (say us-east-1) and you are trying to create a bucket (with the same name as the the bucket that was deleted) in another region right after deleting the bucket.

For point 3, give it up to two days and retry.

if a bucket which is present in a certain region say (us-east-1) is deleted, you can always create a bucket with the same name in another region. There is no such restriction in S3 that states you cannot do this. However, you will be able to do this only after you allow some time after deleting the bucket. This is because S3 buckets follow the Eventual Consistency model in the case of DELETE operation.

It means that after you delete a bucket, it takes a few hours, generally up-to 24 to 48 hours for the DELETE operation to be replicated across all our data centres. Once this change has propagated you can go ahead and create the bucket again in the desired region.

like image 157
mon Avatar answered Nov 27 '25 14:11

mon


I ran into the same issue on 2023.

This tutorial helped me. It basically says that the bucket name need to be unique accross the whole region with all of the AWS accounts there are, so by changing my bucket name the issue was solved.

https://spacelift.io/blog/terraform-aws-provider

like image 41
Ori Shemla Avatar answered Nov 27 '25 14:11

Ori Shemla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!