Creating A Lambda Put Test With Object Metadata

Creating A Lambda Put Test With Object Metadata

Quick post I needed to setup a test for my Lambda function but also pass along metadata with the put test as it is needed within our workflow.

Here is the json of the put test you should notice at the bottom in the object json the extra metadata field with key value pairs.

Hopefully this helps someone and saves them sometime.

{
    "Records": [{
        "eventVersion": "2.0",
        "eventSource": "aws:s3",
        "awsRegion": "us-east-1",
        "eventTime": "1970-01-01T00:00:00.000Z",
        "eventName": "ObjectCreated:Put",
        "userIdentity": {
            "principalId": "EXAMPLE"
        },
        "requestParameters": {
            "sourceIPAddress": "127.0.0.1"
        },
        "responseElements": {
            "x-amz-request-id": "EXAMPLE123456789",
            "x-amz-id-2": "EXAMPLE123/597402740294709247/mnopqrstuvwxyzABCDEFGH"
        },
        "s3": {
            "s3SchemaVersion": "1.0",
            "configurationId": "testConfigRule",
            "bucket": {
                "name": "ott-watch",
                "ownerIdentity": {
                    "principalId": "EXAMPLE"
                },
                "arn": "arn:aws:s3:::ott-watch"
            },
            "object": {
                "key": "1/intro.mp4",
                "size": 1024,
                "eTag": "3204-2384-02384-23084",
                "sequencer": "345345345345",
                "metadata": {
                    "x-amz-meta-id": "c68b672559cd596f3efa54d0bfbdec91"
                }
            }
        }
    }]
}

Leave a comment

Your email address will not be published. Required fields are marked *