Amazon S3 to AWS Lambda

S3 → AWS Lambda

Create a Lambda function that resizes images uploaded to S3.

This CDK stack deploys a Lambda function, a S3 bucket, and the minimum IAM resources required to run the application.
When items are written in the S3 bucket, the changes are sent to a stream. This pattern configures a Lambda function to poll this stream, and log some information to CloudWatch. The function is invoked with a payload containing the information of the event.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/s3-lambda-cdk

Deploy

npm installcdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

1. Delete the stack: npx cdk destroy.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus".
3. You see a message confirming DELETE_COMPLETE.

Created by:

Mário Fonteles

Mário Fonteles

Mário is a Frontend Developer at AWS.