AWS Lambda to Amazon S3

AWS Lambda → Amazon S3

Creates a Lambda function that writes to an S3 bucket.

This SAM template creates a Lambda function that writes to an S3 bucket when invoked. After deployment, enter the name of the destination bucket for the objects to be stored.

< 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/lambda-s3-rust

Deploy

sam deploy --guided


Testing

1. You can test the solution by accessing the Lambda console, finding the Lambda function, and clicking Test in the Code Source section.
2. You can also invoke the function from the CLI using aws lambda invoke --function-name ENTER_FUNCTION_NAME output.txt.
3. Go to the S3 console, locate the deployed S3 bucket, and view the object has been written.

Cleanup

1. Delete the stack: sam delete --stack-name STACK_NAME.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

Daniele Frasca

Daniele Frasca

I am Daniele Frasca serverless enthusiast. I build and architect serverless applications at scale.