AWS Signature Version 4

Est. read: 10 minDeveloper
Canonical AWS request signing flow

Summary

Definition: AWS SigV4 authenticates requests by signing a deterministic, canonical form of the HTTP request using derived keys.

Why it matters: AWS uses the signature to verify request integrity and credential ownership without maintaining server-side session state.

Pitfall: Even minor differences in encoding, ordering, or payload hashing invalidate signatures.

Guide start

AWS Signature Version 4 (SigV4) authenticates AWS API requests by signing a normalized representation of the HTTP request.
The signature binds the request method, path, query parameters, headers, payload hash, date, region, and service into a
verifiable cryptographic value.

Key terms
Canonical request
A deterministic, normalized string representation of an HTTP request.
String to sign
Metadata plus the hash of the canonical request.
Credential scope
Date/region/service/aws4_request context for the signature.
Signing key
Derived HMAC key used to calculate the final signature.
SigV4
AWS Signature Version 4 authentication process.

How SigV4 works

AWS verifies SigV4 requests by rebuilding the canonical request from the received HTTP request.
If the reconstruction differs from what you signed, authentication fails.

AWS does not trust the signature you send at face value. It reconstructs the canonical request from the HTTP request it
receives,
then computes its own signature using the same algorithm. Authentication succeeds only if both signatures match exactly.

Canonical request components

A canonical request is constructed from:

Canonical request parts
Method
HTTP verb such as GET or POST.
URI
Normalized request path.
Query
URL-encoded and sorted parameters.
Headers
Lowercase, trimmed, sorted headers.
Signed list
Semicolon-separated header names.
Payload hash
SHA-256 hash of the body.

Common misconception: SigV4 signs headers implicitly. In reality, only headers listed in SignedHeaders are
protected.

Signing flow

SigV4 signing flow
  1. Build the canonical request.
  2. Hash the canonical request.
  3. Create the string-to-sign.
  4. Derive the signing key.
  5. Compute the signature.
  6. Attach the Authorization header.

Credential scope

The credential scope uniquely identifies the request context:

YYYYMMDD/region/service/aws4_request

Any mismatch between this scope and the actual endpoint causes signature validation to fail.

Authorization header structure

The Authorization header contains:

Authorization header
Credential
Access key ID and credential scope.
SignedHeaders
Semicolon-separated header list.
Signature
Hex-encoded request signature.

Time and clock skew

Requests must use UTC timestamps. AWS typically rejects requests with more than ~5 minutes of clock skew.

  • Synchronize system clocks before signing requests.

Payload handling

  • Payload hashing is required for SigV4.
  • Some services explicitly allow UNSIGNED-PAYLOAD.
  • Large or streaming payloads may require chunked (streaming) SigV4.

UNSIGNED-PAYLOAD is allowed only for specific AWS services and operations.

Temporary credentials

When using IAM roles or STS credentials, include and sign the x-amz-security-token header.

Presigned URLs

SigV4 supports query-string authentication for presigned URLs, which is commonly used for Amazon S3 object access.

Debugging workflow

SigV4 debugging checklist
  • Log the canonical request.
  • Log the string-to-sign.
  • Verify the credential scope.
  • Compare signed headers to sent headers.
  • Confirm the payload hash matches the request body.

FAQ

What headers must be signed? At minimum, host and x-amz-date must be signed. If temporary credentials are used, x-amz-security-token must also be signed.

What causes SignatureDoesNotMatch? Canonical request mismatches, wrong credential scope, header normalization errors, or payload hash differences.

Are query parameters signed? Yes. Canonicalized query parameters are always part of the canonical request.

Does SigV4 encrypt requests? No. SigV4 provides authentication and integrity, not encryption.

Guide end - You can now understand, implement, and debug AWS Signature Version 4 request signing.Back to top