| Service Name: | Lambda |
| ARN Format: | arn:aws:lambda:{region}:{account}:function:{name and qualifier} |
| Style: | Request/Response |
| Actions (required Permissions): |
lambda:InvokeFunction
|
| Payload Format: | JSON object with array of request packet objects |
| Arguments: |
TenantId (string, optional),TenantIdExpression (binary range expression, optional),TenantIdFormatter (string "ascii", "hex", "base64" or "utf8", optional),UseResponseStreaming (boolean, optional)
|
Using an AWS Lambda function as a destination allows great flexibility and capability, and is a great option when generating replies to inbound packets is necessary (StepFunctions is another). Lambda is a good choice for implementing protocols with request/response semantics and provides a familiar development experience.
When Arguments.UseResponseStreaming is set to true, Proxylity invokes your Lambda
function using the InvokeWithResponseStream API instead of the standard InvokeFunction
API. This enables your function to stream response packets back to the remote UDP client throughout the duration
of the Lambda function's execution, rather than buffering all replies until the function completes.
Response streaming enables two key capabilities:
To use response streaming, your Lambda function must be implemented as a response streaming function per AWS guidance. As your function writes response packet objects to the stream, UDP Gateway immediately transmits the corresponding reply packets to the remote client. For details on implementing streaming functions, see AWS's Response streaming documentation and introductory blog post.
Note: Response streaming incurs additional bandwidth charges for bytes streamed beyond the first 6 MB. The first 6 MB streams at uncapped bandwidth; responses larger than 6 MB stream at up to 2 MB/s.
Proxylity's integration with Lambda uses the lambda:InvokeFunction API to deliver batches of packets
to your function. Destination functions can be implemented in any language supported by Lambda, including
Node.js, Python, Java, Go and .NET.
The payload provided to the Lambda function is a JSON object with a property Messages containing an
array of request packet objects. The response from the function is used to
generate replies, and contains a Replies property containing an array of one or more response
packet objects. Response packets are matched to the request packets using the Tag property. If no
replies are needed or appropriate, return an empty array in Replies.
Lambda functions with Tenant Isolation mode enabled require the TenantId parameter to be set on each
invocation. Proxylity supports two approaches for specifying the tenant identifier:
Arguments.TenantId to a fixed string value. All packets
processed by this destination will use the same tenant identifier. This is appropriate when a single listener
is dedicated to one tenant.Arguments.TenantIdExpression to a binary range expression
(e.g., "[0:4]") that extracts bytes from each packet's payload. Optionally specify
Arguments.TenantIdFormatter to control how the extracted bytes are converted to a string—options
are "hex" (default), "ascii", "utf8", or "base64".
This approach enables multi-tenant scenarios where different packets contain different tenant identifiers.
Important: If neither TenantId nor TenantIdExpression is configured,
invocations will not include a tenant identifier. If your Lambda function is configured with Tenant Isolation mode,
these invocations will fail.
When using tenant isolation, batches of packets will be segmented by tenant ID prior to delivery.
Proxylity provides an SDK and project templates to make developing Lambda destinations easier for .NET developers:
Proxylity.UdpGateway.LambdaSdk - Provides typed models and helper methods
for working with UDP Gateway packetsProxylity.Templates - Contains dotnet new templates
for quick project setupInstall the templates and create a new Lambda function:
dotnet new install Proxylity.Templates dotnet new proxylity-udp -n MyUdpHandler
See Lambda destinations in action in our Packet
Counter example, demonstrating request/response UDP packet handling, or watch the video walkthrough of
using the Proxylity.Templates nuget package on YouTube.