Amazon S3 to Amazon SNS

Amazon S3 → Amazon SNS

Sends notifications from S3 to SNS when an object is created.

This SAM template creates an S3 bucket and an SNS topic. S3 writes a messages to the SNS topic when a new object is put into the bucket.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Launch Stack

Clone repo

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

Deploy

sam deploy --guided


Testing

1. Go to the SNS Console and select the topic that was created after running sam deploy.
2. Click on Create Subscription.
3. Under Protocol, select the type of endpoint to subscribe to (email, SMS, etc.)
4. Confirm the message subscription.
5. Upload an object to the S3 bucket you created.
6. Check your notifications.

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:

Julian Wood

Julian Wood

I help developers and builders learn about and love how serverless technologies can transform the way they build and run applications.

Follow on LinkedIn