Parsing DdbJson from DynamoDB Streams events
See original GitHub issueWhen you use DynamoDB Streams and handle item changes with Lambda, the incoming events look like this:
{
"Records": [
{
"eventID": "7de3041dd709b024af6f29e4fa13d34c",
"eventName": "INSERT",
"eventVersion": "1.1",
"eventSource": "aws:dynamodb",
"awsRegion": "region",
"dynamodb": {
"ApproximateCreationDateTime": 1479499740,
"Keys": {
"Timestamp": {
"S": "2016-11-18:12:09:36"
},
"Username": {
"S": "John Doe"
}
},
"NewImage": {
"Timestamp": {
"S": "2016-11-18:12:09:36"
},
"Message": {
"S": "This is a bark from the Woofer social network"
},
"Username": {
"S": "John Doe"
}
},
"SequenceNumber": "13021600000000001596893679",
"SizeBytes": 112,
"StreamViewType": "NEW_IMAGE"
},
"eventSourceARN": "arn:aws:dynamodb:region:123456789012:table/BarkTable/stream/2016-11-16T20:42:48.104"
}
]
}
Is there any way to parse the NewImage
into the dotnet model?
DdbJsonReader
is marked as internal and DynamoDbLowLevelContext
does not expose such functionality.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Using AWS Lambda with Amazon DynamoDB streams
Tutorial: Using AWS Lambda with Amazon DynamoDB streams. In this tutorial, you create a Lambda function to consume events from an Amazon DynamoDB...
Read more >How to get the pure Json string from DynamoDB stream ...
My Question is how can i get the pure json string of the DynamoDB item that's been sent over the stream? I'm using...
Read more >Parse DynamoDB Stream events? · Issue #1212
I receive a JSON from a DynamoDB stream in a process, and I would like to parse the NewImage into a "normal" hash,...
Read more >DynamoDB Streams - The Ultimate Guide (w/ Examples)
Learn all about Amazon DynamoDB Streams, how to use them with AWS Lambda, their uses cases, best practices, examples and more.
Read more >Using DynamoDB Streams Lambda Made Easy - Learn
The combination of DynamoDB Streams and AWS Lambda unlocks many powerful design patterns. This exercise will show you how to use a Lambda ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @wjax, sorry for the late reply. A long time ago I was experimenting with lambda and here is the example that parses a lambda stream into the request object.
It is also a good example of how to deserialize and map a DynamoDb JSON into a class. It is possible but requires applying attributes in certain cases (one of the reasons it is internal).
If you are up for testing the
LambdaSerializer
class from that branch, we should be able to polish it and add it to the library 🤔 .Many many thanks! I will come back after having tested it!