Skip to content

SNS/SQS Record Object

The SNS/SQS event will by default provide instances of record classes which will be easier to work with then a standard lambda event record object. This is the same object which will be passed down to the dataClass, if you provide on in your configuration. Below is a list of all the properties and example outputs for the SNS/SQS event record:

Examples

Don't like reading documentation? Then look at our examples, which can be deployed in 1 command into your AWS account! 🤓

Record Properties

property type description
attributes object the attributes of the message
body object the object from the bucket in memory; decodes json automatically
id str the id of message
md5 str the message in an md4 hash format
messageAttributes object the attributes of the message, flattened
raw any the body of the message as is, no conversion
receiptHandle str the handle of the receipt
region str the region of the message
source str the source of the event which invoked the lambda
sourceARN str the arn of the source

record.attributes

1
2
3
4
5
6
7
8
9
console.log(record.attributes);

// example output:
{
    "ApproximateReceiveCount": "1",
    "SentTimestamp": "1545082650636",
    "SenderId": "AIDAIENQZJOLO23YVJ4VO",
    "ApproximateFirstReceiveTimestamp": "1545082650649"
}

record.body

1
2
3
4
5
6
console.log(record.body);

// example output:
{
    some_key: 'some_value'
}

record.source

1
2
3
4
console.log(record.source);

// example output:
'aws:sqs'

record.md5

1
2
3
4
console.log(record.md5);

// example output:
'e4e68fb7bd0e697a0ae8f1bb342846b3'

record.messageAttributes

1
2
3
4
5
6
console.log(record.messageAttributes);

// example output:
{
    some_attribute_key: 'some_attribute_value'
}

record.id

1
2
3
4
console.log(record.id);

// example output:
'2e1424d4-f796-459a-8184-9c92662be6da'

record.raw

1
2
3
4
console.log(record.raw);

// example output:
'{"some_key": "some_value"}'

record.receiptHandle

1
2
3
4
console.log(record.receiptHandle);

// example output:
'AQEBzWwaftRI0KuVm4tP+/7q1rGgNqicHq...'

record.region

1
2
3
4
console.log(record.region);

// example output:
'us-east-2'

record.sourceARN

1
2
3
4
console.log(record.sourceARN);

// example output:
'arn:aws:sqs:us-east-2:123456789012:my-queue'