Skip to main content


Middleware for iterating through an AWS event records, parsing and normalizing nested events.

AWS Events Transformations:

Event SourceIncludedComments
AlexaNoNormalization not required
API Gateway (HTTP)No *See middleware prefixed with @middy/http-
API Gateway (REST)No *See middleware prefixed with @middy/http-
API Gateway (WS)No *See middleware @middy/ws-json-body-parser
Application LBNo *See middleware prefixed with @middy/http-
CloudFormationNoNormalization not required
CloudFrontNoNormalization not required
CloudTrailNoNormalization not required
CloudWatch LogsYesBase64 decode and JSON parse data
CodeCommitNoNormalization not required
CodePipelineYesJSON parse UserParameters
CognitoNoNormalization not required
ConfigYesJSON parse invokingEvent and ruleParameters
ConnectNoNormalization not required
DynamoDBYesUnmarshall Keys, OldImage, and NewImage
EC2NoNormalization not required
EventBridgeNoNormalization not required
IoTNoNormalization not required
IoT EventNoNormalization not required
KafkaYesBase64 decode and JSON parse value
Kafka (MSK)YesBase64 decode and JSON parse value
Kinesis FirehoseYesBase64 decode and JSON parse data
Kinesis StreamYesBase64 decode and JSON parse data
LexNoNormalization not required
MQYesBase64 decode and JSON parse data
RDSNoNormalization not required
S3YesURI decode key
S3 BatchYesURI decode s3Key
S3 Object LambdaNo *See middleware @middy/s3-object-response
Secrets ManagerNoNormalization not required
SESNoNormalization not required
SNSYesJSON parse Message
SQSYesJSON parse body

* Handled in another dedicated middleware(s)

Test Events Some events send test events after set, you will need to handle these.

// S3 Test Event
Service: 'Amazon S3',
Event: 's3:TestEvent',
Time: '2020-01-01T00:00:00.000Z',
Bucket: 'bucket-name',
RequestId: '***********',
HostId: '***/***/***='


To install this middleware you can use NPM:

npm install --save @middy/event-normalizer

Sample usage

import middy from '@middy/core'
import eventNormalizer from '@middy/event-normalizer'

const lambdaHandler = (event, context) => {
const { Records } = event
for(const record of Records) {
// ...

const handler = middy(lambdaHandler).use(eventNormalizer())


To exclude aws-sdk add aws-sdk/clients/dynamodb.js to the exclude list.