Getting started Community Training Tutorials Documentation APIs, AI & Tools
AWS Lambda
Policy name |
AWS Lambda |
Summary |
Triggers an AWS Lambda function from a standard HTTP request |
Category |
Transformation |
First Omni Gateway version available |
v1.9.0 |
Release Notes |
|
Returned Status Codes |
502 - Bad Gateway, requests are blocked due to circuit breaker activation |
The AWS Lambda policy triggers an AWS Lambda function from a standard HTTP request. Pass the HTTP request payload as is or wrapped in a JSON schema.
The AWS Lambda policy is an extension of the AWS Lambda filter native to Envoy. To learn more about the AWS Lambda filter, see AWS Lambda Filter. Not all AWS Lambda filter parameters are available to the AWS Lambda policy. To find what parameters are configurable, see Configure Policy Parameters.
The AWS Lambda policy always buffers the full request body to calculate the AWS Signature Version 4 (SigV4) signature hash, whether or not payloadPassthrough is enabled. Requests without a body aren’t buffered.
The policy converts and buffers the Lambda function’s JSON response only when payloadPassthrough is false and invocationMode is sync. The policy returns error responses (a status code of 300 or higher, or an x-amz-function-error header) as is. When payloadPassthrough is true or invocationMode is async, the policy also returns the response as is.
Buffered payloads count toward the Omni Gateway payload limit, which is 1 MB by default. To change the limit on a self-managed Omni Gateway, set the FLEX_DOWNSTREAM_CONNECTION_BUFFER_LIMIT_BYTES environment variable. In Connected Mode, you can also set Global connection buffer limit in Runtime Manager. For more information, see Configure Global and Routing Settings in Runtime Manager. For more information about the limit, see Omni Gateway Limits and Performance Metrics.
When you apply the policy via declarative configuration files, Refer to the following policy definition and table of parameters:
- policyRef:
name: native-aws-lambda
config:
arn: <string> // REQUIRED
payloadPassthrough: <boolean> // REQUIRED
invocationMode: <string> // REQUIRED
authenticationMode: <string> // REQUIRED
credentialProfile: <string> // OPTIONAL
credentials:
accessKeyId: <string> // OPTIONAL
secretAccessKey: <string> // OPTIONAL
sessionToken: <string> // OPTIONAL
| Parameter | Required or Optional | Default Value | Description |
|---|---|---|---|
|
Required |
N/A |
AWS Lambda ARN in this format: |
|
Required |
false |
By default, Omni sends the request to the AWS Lambda function wrapped in JSON. When |
|
Required |
sync |
The way to invoke the Lambda function, either |
|
Required |
N/A |
Determines the mode of authentication. Options are: |
|
Optional |
N/A |
Specifies the credential |
|
Optional |
N/A |
Configures the |
|
Required |
N/A |
AWS access key ID |
|
Required |
N/A |
AWS access key |
|
Optional |
N/A |
Session token |
The following example defines a rate limit of three requests every six seconds:
- policyRef:
name: native-aws-lambda
config:
arn: rn:<partition>:lambda:<region>:<account-number>:function:<function-name>
payloadPassthrough: true
invocationMode: sync
authenticationMode: static
credentials:
accessKeyId: id
secretAccessKey: secret
sessionToken: token
When you apply the policy from the UI, the following parameters are displayed:
| Parameter | Required or Optional | Description |
|---|---|---|
The ARN of the AWS Lambda |
Required |
AWS Lambda ARN in this format: |
Payload passthrough |
Required |
By default, Omni sends the request to the AWS Lambda function wrapped in JSON. When enabled, the request is sent as is. |
Determines the way to invoke the Lambda function |
Required |
The way to invoke the Lambda function. For Sync, Omni Gateway awaits the AWS response. For Async, Omni Gateway doesn’t wait for the response from AWS. |
Determines origin of credentials |
Required |
Determines the mode of authentication. Options are: Default, uses in order credential AWS environment variables, AWS credential file, AWS roles; Profile, profile from AWS credential file; Static, credentials configured in the policy. |
Credentials profile |
Optional |
Specifies the credential profile. Only for Profile authentication mode. |
Credentials |
Optional |
Configures the static credentials. Only for Static authentication mode. |
AccessKeyId |
Required |
AWS access key ID |
SecretAccessKey |
Required |
AWS access key |
SessionToken |
Optional |
Session token |