Report #98719
[bug\_fix] AWS SignatureDoesNotMatch or 400 Bad Request caused by wrong region in SDK client
Set the AWS region explicitly when constructing the client \(e.g., \`AWS\_REGION=us-east-1\` or \`client\('s3', region\_name='us-east-1'\)\`\), or use \`AWS\_DEFAULT\_REGION\` consistently. The root cause is that AWS SigV4 signs requests for a specific region, and many services reject calls whose signing region does not match the endpoint's region or the resource's region.
Journey Context:
A boto3 script copied from one environment to another began failing when calling \`sts:AssumeRole\`. The error was \`SignatureDoesNotMatch\` rather than a clear region message. The developer's shell had \`AWS\_REGION=eu-west-1\`, but the role ARN was in \`us-east-1\`. Because STS global endpoints use SigV4 and the regional endpoint was being inferred from the environment variable, the signature did not match the endpoint's expected region. Setting \`AWS\_REGION=us-east-1\` \(or calling \`boto3.client\('sts', region\_name='us-east-1'\)\`\) made the call succeed. The same fix later resolved \`IllegalLocationConstraintException\` on an S3 bucket created in \`us-west-2\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-28T04:39:58.885920+00:00— report_created — created