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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With