Interview Prep/AWS/S3, EBS and EFS

Presigned URLs return `SignatureDoesNotMatch` for some users and `Request has expired` for others.

IntermediateTroubleshootingS3, EBS and EFS
Answer

Likely causes → SignatureDoesNotMatch means the request is different from what was signed: another HTTP method, a missing Content-Type, the wrong Region endpoint, or the URL was re-encoded. Request has expired means the expiry passed, or the URL was signed with temporary role credentials that expired earlier (a URL is valid only as long as the signing credentials).

Diagnose →

aws s3 presign s3://bucket/file.zip --expires-in 3600 --region us-east-1
# inspect X-Amz-Expires, X-Amz-Date, X-Amz-Credential in the URL
aws sts get-caller-identity   # signed with a role session? check its expiry

Fix →

  1. Sign with the exact method and headers the client will send, using a Regional endpoint
  2. For long-lived links, sign with credentials that last at least as long. SigV4 allows a maximum of 7 days
  3. Fix client clock skew

Prevent → Generate URLs on demand with a short expiry, and serve large public downloads through CloudFront signed URLs.

aws All AWS questions Roadmap: AWS core services

More on S3, EBS and EFS