awslabs / awslabs/aws-sdk-rust

[request]: Serialize/Deserialize of models for Lambda events

Open
#269 12 comments 48 reactions 0 assignees View on GitHub
feature-request high-level-library p2
Dominant language
Rust
Stars
3.3k
Forks
290
Avg merge
1d 12h
Merged PRs (30d)
3

Description

### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue, please leave a comment

**Tell us about your request**

Add support for deserialization of structs for use with Lambda events. This is similar to https://github.com/awslabs/aws-sdk-rust/issues/211, but for event sources that integrate with Lambda.

Alternatively, we could provide a official set of Lambda events, but this would be hard to do without an authoritative repository of event schemas for Lambda.

**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**

I am currently writing a Lambda function in Rust for a [GitHub sample](https://github.com/aws-samples/serverless-rust-demo) that's invoked from a DynamoDB streams to showcase how to do parallel processing within a Lambda function.

Lambda's [Event Source Mapping](https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html) takes care of polling events from the DynamoDB stream and invoking the Lambda function with a batch. Lambda sends a JSON objects resembling [`aws_sdk_dynamodbstreams::output::GetRecordsOutput`](https://awslabs.github.io/aws-sdk-rust/aws_sdk_dynamodbstreams/output/struct.GetRecordsOutput.html) without `NextShardIterator`.

**Are you currently working around this issue?**

Right now, I've recreated most of it by making my own `struct`s copying the Go Lambda SDK's [`DynamoDBEvent`](https://github.com/aws/aws-lambda-go/blob/1cb90e0cf5114f9d11568e3aa2322a4f4675447b/events/dynamodb.go#L7-L9) structure.

**Additional context**

N/A

**Attachments**

* [Pull Request (in progress)](https://github.com/aws-samples/serverless-rust-demo/pull/15)

Contributor guide

Open the contributing guide

Research direction

Review the DynamoDB stream event shape in aws-samples/serverless-rust-demo#15 and the Go reference at events/dynamodb.go, then compare it with aws_sdk_dynamodbstreams::output::GetRecordsOutput. Done means defining an agreed way to serialize and deserialize Lambda event structs, with coverage for the requested event shape.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, rust
Domain
backend, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.