Anatomy of an s3-upload event

The following is an example of an event that is generated when a file is uploaded to an S3 Bucket.

Details

The bucket-name is listed in: [Records][0][S3][bucket][name]
The filename is listed in: [Records][0]S3][object][key]

this information can be used all over the place:

eventdata

The notification message that Amazon S3 sends to publish an event is in the JSON format.

{
   "Records":[
      {
         "eventVersion":"2.1",
         "eventSource":"aws:s3",
         "awsRegion":"eu-west-1",
         "eventTime":"2022-09-19T06:21:54.899Z",
         "eventName":"ObjectCreated:Put",
         "userIdentity":{
            "principalId":"AWS:AIDAIVYFIYZU7ONB22PQA"
         },
         "requestParameters":{
            "sourceIPAddress":"77.94.246.48"
         },
         "responseElements":{
            "x-amz-request-id":"ZB2JV90VJ3Y3SQ2K",
            "x-amz-id-2":"9/D9HMEYl8GaBwkkm0PDK13qb/iuh2HmAiV0YE0wIJQ8iXRNTwq6HGC0T8f+/c3/Qhe/evUiKVhyQcqwp+oon5GQlnpMuOe+"
         },
         "s3":{
            "s3SchemaVersion":"1.0",
            "configurationId":"Upload",
            "bucket":{
               "name":"0-aws-training-examplebucket-april-2022-by-nando",
               "ownerIdentity":{
                  "principalId":"A1H3CC4J52T2YO"
               },
               "arn":"arn:aws:s3:::0-aws-training-examplebucket-april-2022-by-nando"
            },
            "object":{
               "key":"testing.md",
               "size":4887,
               "eTag":"23e3b7ad434207b6b05d48f70b27d358",
               "sequencer":"0063280A82D9E2001C"
            }
         }
      }
   ]
}

Conclusion