AWS Signature Version 4.
AWS signs requests instead of issuing bearer tokens, and the reason matters to anyone implementing it: the secret access key never travels. A signature proves possession, binds the method, path, query, headers and a hash of the body to one date, region and service, and expires with the timestamp in its credential scope. Presigned URLs and STS temporary credentials are built on that; a bearer token gives all of it up.
The cost is placement. A signature covers the exact bytes that go on the wire, so it cannot be a header a caller adds in advance: it is computed after the request body has been serialized, which is why signing sits beside the transport and not inside a codec.
LlmCall.EncodedRequest.path is signed re-encoded, not verbatim. SigV4's
canonical URI is the URI-encoded path, and for every service except S3 that means
encoding the bytes a request would carry — so a path segment a codec wrote as
%3A (a Bedrock model id's colon) is canonicalised to %253A. Signing it verbatim
is the mistake that only a real endpoint reports, as a signature mismatch, and it
was found by comparing against botocore rather than by reasoning. A codec still
percent-encodes its path, so the URL is what the provider expected.
The query string is encoded here instead: URI.encode_query/1 writes a space as
+ where SigV4 requires %20, and the canonical form is sorted after encoding.
Summary
Functions
Signs request and returns it carrying host, x-amz-date and authorization.
Functions
@spec sign(LlmCall.HTTP.Request.t(), keyword()) :: {:ok, LlmCall.HTTP.Request.t()} | {:error, LlmCall.Error.t()}
Signs request and returns it carrying host, x-amz-date and authorization.
Options: service:, region:, credentials: (a map with :access_key_id and
:secret_access_key, and optionally :session_token and :expiration), query:
(the merged query map) and now:.