S3 Record Object
The S3 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 S3 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 object from the bucket in memory; buffer, json or csv object |
bucket |
str |
the name of the bucket |
id |
str |
the id of configuration |
key |
str |
the bucket key |
name |
str |
the name of the event which invoked the lambda |
object |
object |
the object described from the bucket |
operation |
str |
triggered operation lambda (create, delete) |
region |
str |
the region the record is from |
request |
object |
the request parameters |
response |
object |
the response parameters |
source |
str |
the source of the event which invoked the lambda |
time |
float |
the event time |
version |
object |
the s3 schema version |
record.region
| console.log(record.region);
// example output:
'us-east-2'
|
record.body
| console.log(record.body);
// example output: depending on the configuration, it might be a Buffer, CSV, or JSON object
// does require `getObject: true` to be set in the options of the EventClient
|
record.bucket
| console.log(record.bucket);
// example output:
{
"name": "DOC-EXAMPLE-BUCKET",
"ownerIdentity": {
"principalId": "A3I5XTEXAMAI3E"
},
"arn": "arn:aws:s3:::lambda-artifacts-deafc19498e3f2df"
}
|
record.id
| console.log(record.id);
// example output:
'828aa6fc-f7b5-4305-8584-487c791949c1'
|
record.name
| console.log(record.name);
// example output:
'ObjectCreated:Put'
|
record.source
| console.log(record.source);
// example output:
'aws:s3'
|
record.time
| console.log(record.time);
// example output:
'2019-09-03T19:37:27.192Z'
|
record.key
| console.log(record.key);
// example output:
'some-directory/b21b84d653bb07b05b1e6b33684dc11b.json'
|
record.object
| console.log(record.object);
// example output:
{
'key': 'some-directory/b21b84d653bb07b05b1e6b33684dc11b.json',
'size': 1305107,
'eTag': 'b21b84d653bb07b05b1e6b33684dc11b',
'sequencer': '0C0F6F405D6ED209E1'
}
|
record.operation
| console.log(record.operation);
// example output:
'create'
|
record.request
| console.log(record.request);
// example output:
{
"sourceIPAddress": "205.255.255.255"
}
|
record.response
| console.log(record.response);
// example output:
{
"x-amz-request-id": "D82B88E5F771F645",
"x-amz-id-2": "vlR7PnpV2Ce81l0PRw6jlUpck7Jo5ZsQjryTjKlc5aLWGVHPZLj5NeC6qMa0emYBDXOo6QBU0Wo="
}
|
record.version
| console.log(record.version);
// example output:
"1.0"
|