Skip to content

Commit c93091c

Browse files
committed
fix: set explicit region on S3 client to fix presigned URL signature mismatch
boto3.client('s3') without a region defaults to us-east-1, so presigned URLs get signed for us-east-1 while the bucket is in eu-central-1, causing 'signature mismatch' errors. Pass AWS_REGION (auto-set by Lambda runtime).
1 parent b74206d commit c93091c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • infrastructure/lambdas/check_status

infrastructure/lambdas/check_status/index.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
from botocore.exceptions import ClientError
2929

3030
dynamodb = boto3.resource("dynamodb")
31-
s3_client = boto3.client("s3")
31+
# Region must be explicit when generating presigned URLs with STS credentials.
32+
# Without it boto3 defaults to us-east-1, causing a signature mismatch for
33+
# buckets in other regions.
34+
s3_client = boto3.client("s3", region_name=os.environ.get("AWS_REGION"))
3235

3336
TABLE_NAME = os.environ["DYNAMODB_TABLE"]
3437
S3_BUCKET = os.environ["S3_BUCKET"]

0 commit comments

Comments
 (0)