Expand description
AWS Lambda serverless-upstream plugin (aws-lambda).
Port of APISIX’s aws-lambda plugin (3.17). Invokes an AWS Lambda function
through its function URL (or an API Gateway endpoint) and returns the
function’s reply as the gateway response — it replaces the upstream, so
the node’s success port should be wired straight to client.in.
Two authorization modes are supported:
- API key (
authorization.apikey) — the key is sent as thex-api-keyrequest header, no signing. - IAM / SigV4 (
authorization.iam) — the request is signed with AWS Signature Version 4 (AWS4-HMAC-SHA256). The signing itself is factored into the puresign_v4function, unit-tested against the published AWS SigV4get-vanillatest vector.
On a callout failure the node rejects through its error port with
AWS_LAMBDA_CALLOUT_ERROR (a 502/503 depending on the failure kind).
§Deviations from APISIX
- Only the minimal header set
host,x-amz-dateand (when present)x-amz-security-tokenis covered by the SigV4 signature. AWS permits signing a subset of headers, and the remaining forwarded headers are sent unsigned; APISIX signs every forwarded header. aws_servicedefaults tolambda(APISIX defaults toexecute-api).ssl_verifydefaults tofalse, matching APISIX’s documented behavior for this plugin.
Structs§
- AwsLambda
Plugin - Invokes an AWS Lambda function and maps its reply into
Context.response. - IamAuth 🔒
- IAM credentials driving AWS SigV4 request signing.
- SigV4
Input 🔒 - Inputs to
sign_v4.canonical_queryis a pre-built, sorted, encoded query string;headersis the exact set of headers to cover by the signature (names in any case, values already trimmed of outer whitespace). - SigV4
Output 🔒 - Result of a SigV4 signing pass.
Enums§
- Authorization 🔒
- The plugin’s resolved authorization strategy.
Constants§
- ALGO 🔒
Functions§
- apply_
response 🔒 - Copies the FaaS reply into
Context.response(status, headers, body). - canonical_
query_ 🔒string - Builds the SigV4 canonical query string: URI-encode every name and value, then sort the pairs by encoded name and value.
- civil_
from_ 🔒days - Converts a count of days since the unix epoch into
(year, month, day)using Howard Hinnant’s civil-date algorithm. - derive_
signing_ 🔒key - Derives the SigV4 signing key via the HMAC date → region → service chain.
- format_
amz_ 🔒date - Formats a unix timestamp as an AWS
amz-date(YYYYMMDDTHHMMSSZ, UTC). - hex 🔒
- Lowercase-hex encoding of a byte slice.
- hmac_
sha256 🔒 - HMAC-SHA256 over
msgwithkey. - normalize_
path 🔒 - Normalizes a request path for the SigV4 canonical URI: an empty path
becomes
/, and a trailing slash on a non-root path is dropped. - reject 🔒
- Builds the
AWS_LAMBDA_CALLOUT_ERRORrejection carrying the context. - sha256 🔒
- SHA-256 digest of
data. - sign_v4 🔒
- Computes an AWS Signature Version 4 for the given request.
- uri_
encode 🔒 - Percent-encodes a string per RFC 3986, leaving the SigV4 unreserved set
(
A-Z a-z 0-9 - _ . ~) intact.