A simple parse tool to just parses the events triggering your AWS Lambda into a common format, so you don't have to worry.
{
sourceType: 'api',
sourceEvent: originalEvent,
records: [{
userId: 123
}] // array of events (with parameters as properties)
}
API Gateway GET Request Event:
?userId=456&name=someoneUnknown
{
httpMethod: 'GET',
queryStringParameters: {
userId: 456,
name: 'someoneUnknown'
}
}
}
will be translated into ->
{
sourceType: 'api',
sourceEvent: originalEvent, // the complete, unchanged GET request event objet
records: [{
userId: 123,
name: 'someoneUnknown'
}] // array of events (with parameters as properties)
}
Let's take another example, an S3 Event:
S3 Event:
{
Records: [
{
s3: {
object: {
key: "HappyFace.jpg",
size: 1024
}
}
}
]
}
will be translated into:
{
sourceType: 's3',
sourceEvent: originalEvent, // the complete, unchanged S3 event objet
records: [{
key: "HappyFace.jpg",
size: 1024
}] // array of events (with parameters as properties)
}
SNS Event:
{
"Records": [
{
"eventID": "7de3041dd709b024af6f29e4fa13d34c",
"eventName": "INSERT",
"eventVersion": "1.1",
"eventSource": "aws:dynamodb",
"awsRegion": "us-west-2",
"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:us-east-1:123456789012:table/BarkTable/stream/2016-11-16T20:42:48.104"
}
]
}
will be translated into:
{
sourceType: 's3',
sourceEvent: originalEvent, // the complete, unchanged S3 event objet
records: [{
key: "HappyFace.jpg",
size: 1024
}] // array of events (with parameters as properties)
}
- SNS
- S3
- API Gateway (GET, POST, PUT, DELETE, PATCH)
- DynamoDB Streams (NEW_IMAGE)
- SQS
- Other AWS Lambda
- CloudWatch
- Kinesis DataFirehose
- Kinesis Data Streams
- SES
MIT
Aleksandar Simovic