Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why in AWS CLI is required to specify region when using pre-signed URL?

When I use the command aws s3 presign s3://my_bucket/my_image.png without specifying region I get an URL which redirects me to

<Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>

Later, if I use aws s3 presign s3://my_bucket/my_image.png --region us-east-1 then it displays image correctly, but why is the --region us-east-1 required in order to work?

like image 298
pedro_bb7 Avatar asked Nov 06 '25 02:11

pedro_bb7


1 Answers

Because pre-signed S3 urls use sig4 signatures and this requires region. From docs:

The signing key is scoped to a specific Region and service, and it never expires.

Also, from CLI docs:

For sigv4 requests the region needs to be configured explicitly.

like image 141
Marcin Avatar answered Nov 09 '25 00:11

Marcin