Amazon S3
Trigger AWS Lambda from an S3 event

In this pattern, we will walk through how to trigger AWS Lambda from S3 object events.
Packages Required
Function Code
The S3 to Lambda integration is what is known as an asynchronous invoke. Events are forwarded to the Lambda service and processed asynchronously, meaning the caller can continue doing other work.
The S3Event object contains an array of S3EventNotification objects. S3 Events are passed to Lambda in batches.
The S3EventNotification object contains both an Bucket and Object property. It's important to note that the Object.Key property will always be URL encoded. However, if you need to make a call to the S3 API then you need the URL decoded key string. That's caught me out many times 😢
Best Practices
- Remember to URL decode your object key if you need to do any further work with the S3 API.