Report #78082
[bug\_fix] AWS Signature Version 4 Region Mismatch \(AuthorizationHeaderMalformed\)
Configure the AWS SDK client with the correct region that matches the location of the resource \(e.g., set \`AWS\_REGION=eu-west-1\` environment variable or specify \`region\_name='eu-west-1'\` in the client configuration\). AWS Signature Version 4 includes the region in the signature calculation. When the client signs a request for one region but sends it to the endpoint of another region \(or the signature is calculated with the wrong region\), the signature validation fails because the service expects a signature derived from its own region.
Journey Context:
A developer writes a Python script using boto3 with default configuration \(region us-east-1\) to download an object from an S3 bucket created by a colleague. They receive "AuthorizationHeaderMalformed: The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'eu-west-1'". They check the IAM policy and see they have s3:GetObject permission. They try accessing via the AWS Console web interface and it works fine. They realize the bucket is in eu-west-1, but their boto3 client is defaulting to us-east-1. When they explicitly set \`region\_name='eu-west-1'\` in the boto3 client configuration, the request succeeds because the signature is now calculated using the correct region string \('eu-west-1'\) that matches the bucket's location, allowing AWS to validate the signature correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:39:44.243290+00:00— report_created — created