# SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided

AWS error fixes · Updated 16 November 2026

**Short answer:** AWS recognised your access key ID but computed a different signature from the one you sent, so either the secret access key is wrong or the request changed after it was signed. Check the secret for typos or trailing whitespace first; for S3 presigned URLs, make sure the HTTP method and signed headers such as Content-Type match exactly what was signed.

## What the error tells you

Every AWS request is signed with your secret key over a canonical form of the request: method, path, query string, selected headers and a hash of the body. AWS rebuilds that canonical request on its side and compares signatures. A mismatch means the access key ID was found (otherwise you'd see `InvalidAccessKeyId` or `InvalidClientTokenId`) but something else differs.

```
An error occurred (SignatureDoesNotMatch) when calling the PutObject operation:
The request signature we calculated does not match the signature you provided.
Check your key and signing method.
```

S3 helps more than most services: its XML error body includes `<StringToSign>` and `<CanonicalRequest>`, which you can diff against what your client signed.

## Common causes, most likely first

| Cause | Typical situation |
|---|---|
| Wrong secret access key for that key ID | Secret pasted from the wrong row, or a rotated key's old secret still in a file |
| Whitespace or a newline in the secret | Secret stored in a CI variable, Kubernetes secret (`echo` without `-n` before base64) or `.env` file |
| Presigned URL used with a different method or headers | URL generated for `get_object` but used for a PUT, or browser upload sends a `Content-Type` that wasn't signed |
| Something rewrote the request in transit | A proxy, CDN or load balancer changed the host, path encoding or a signed header |
| Hand-rolled SigV4 code | Object keys with spaces, `+` or Unicode encoded differently from AWS's rules |

## How to fix it

1. **Test the key pair in isolation.** If this fails with the same error, the secret is wrong:

   ```
   AWS_PROFILE=ci aws sts get-caller-identity
   ```

2. **Look for invisible characters.** Print the length of the secret (it is 40 characters for IAM user keys) and check for a trailing newline:

   ```
   printf '%s' "$AWS_SECRET_ACCESS_KEY" | wc -c
   grep -n ' $' ~/.aws/credentials
   ```

3. **For presigned PUT URLs**, sign for `put_object` and include the exact `ContentType` the client will send. If the browser adds a different `Content-Type`, the signature breaks.

4. **Inspect the signing input.** Run the failing command with `--debug` and compare the logged `CanonicalRequest` with the one in S3's error response; the first differing line is your bug.

   ```
   aws s3api put-object --bucket my-bucket --key 'reports/q3 summary.pdf' \
     --body summary.pdf --debug 2>&1 | grep -A12 'CanonicalRequest'
   ```

5. **If nothing else works**, create a new access key, update the stored secret, and deactivate the old key once the new one is confirmed.

## Mistakes people make next

- Regenerating keys repeatedly while the real fault is a proxy or an unsigned header. If the CLI works from your laptop with the same keys, the keys are fine.
- Confusing this with clock problems. A skewed clock produces `RequestTimeTooSkewed` or "Signature expired", not this error; see [signature expired](https://cloudconsole.dev/errors/signature-expired-clock-skew).
- Using an old SDK that defaults to Signature Version 2 against regions or buckets that only accept SigV4. Upgrade the SDK rather than forcing the signature version.

## Questions

### What causes S3 error 403 SignatureDoesNotMatch?

Most often a wrong or whitespace-damaged secret access key, or a presigned URL used with a different HTTP method or Content-Type than the one it was signed for.

### How do I debug an S3 signature mismatch?

Compare the CanonicalRequest S3 returns in the error body with the one your client signed; with the CLI, add --debug to see it. The first line that differs shows what changed.

### Is SignatureDoesNotMatch caused by the wrong region?

Not usually. A wrong signing region for S3 normally produces AuthorizationHeaderMalformed with a hint naming the expected region.

## When this happens away from your desk

Signature errors usually show up as a spike of 4xx responses from an upload feature rather than a page. CloudConsole, a phone app for AWS, is built to put those alarms and the related log lines on your phone so you can tell a broken release from a broken key.

[About the CloudConsole app](https://cloudconsole.dev/aws-console-app) · [Download on the App Store](https://apps.apple.com/app/cloudconsole-for-aws/id6835419710)

## Sources

- [AWS Signature Version 4 for API requests](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html)
- [Amazon S3 documentation](https://docs.aws.amazon.com/s3/)

## Related

- [S3 AccessDenied: Access Denied when calling an S3 operation](https://cloudconsole.dev/errors/s3-access-denied)
- [InvalidSignatureException: Signature expired](https://cloudconsole.dev/errors/signature-expired-clock-skew)
- [InvalidAccessKeyId: The AWS Access Key Id you provided does not exist in our records](https://cloudconsole.dev/errors/s3-invalidaccesskeyid)
- [aws s3 presign](https://cloudconsole.dev/cli/s3-presign)
- [AccessDenied: Request has expired (presigned URL)](https://cloudconsole.dev/errors/s3-request-has-expired)
- [How to rotate IAM access keys](https://cloudconsole.dev/how-to/rotate-iam-access-keys)

---

Source: https://cloudconsole.dev/errors/signaturedoesnotmatch

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
