DynamoDB Record Object
The DynamoDB event will by default provide instances of record
classes which will be easier to work with then 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 DynamoDB event record:
Example
Don't like reading documentation? Then look at our examples which can be deploy in 1 command into your AWS account!
Record Properties
property |
type |
description |
body |
object |
the new image of dynamodb record; created or updated |
created |
float |
the approximate creationDate time |
expired |
bool |
whether the ttl has expired |
id |
str |
the id of the event which invoked the lambda |
identity |
object |
the identity who triggered the dynamodb change |
keys |
object |
the keys of DynamoDB record |
name |
str |
the name of the event which invoked the lambda |
newImage |
object |
the new image of dynamodb record; created or updated |
oldImage |
object |
the old image of dynamodb record; updated or deleted |
operation |
str |
triggered operation lambda (create, update, delete) |
region |
str |
the region the record is from |
size |
int |
the size in bytes of the record |
source |
str |
the source of the event which invoked the lambda |
sourceARN |
str |
the event source arn |
streamType |
str |
the stream view type |
version |
str |
the event version |
record.region
| console.log(record.region);
// example output:
'us-east-2'
|
record.id
| console.log(record.id);
// example output:
'9a37c0d03eb60f7cf70cabc823de9907'
|
record.name
| console.log(record.name);
// example output:
'INSERT'
|
record.source
| console.log(record.source);
// example output:
'aws:dynamodb'
|
record.keys
Info
This is converted from the original DDB JSON to standard json
| console.log(record.keys);
// example output:
{
example_id: '123456789'
}
|
record.oldImage
Info
This is converted from the original DDB JSON to standard json
| console.log(record.oldImage);
// example output:
{
old_data: '123456789'
}
|
record.newImage
Info
This is converted from the original DDB JSON to standard json
| console.log(record.newImage);
// example output:
{
new_data: '123456789'
}
|
record.body
Info
This is converted from the original DDB JSON to standard json from newImage
| console.log(record.body);
// example output:
{
new_data: '123456789'
}
|
record.operation
| console.log(record.operation);
// example output:
'create'
|
record.sourceARN
| console.log(record.sourceARN);
// example output:
'arn:aws:dynamodb:us-east-1:771875143460:table/test-example/stream/2019-10-04T23:18:26.340'
|
record.version
| console.log(record.version);
// example output:
'1.1'
|
record.streamType
| console.log(record.streamType);
// example output:
'NEW_AND_OLD_IMAGES'
|
record.size
| console.log(record.size);
// example output:
1124
|
record.created
| console.log(record.created);
// example output:
1538695200.0 //unix timestamp
|
record.identity
| console.log(record.identity);
// example output:
{
type: 'Service',
principalId: 'dynamodb.amazonaws.com'
}
|
record.expired
| console.log(record.expired);
// example output:
false
|