Amazon S3 to Amazon SQS

Amazon S3 → SQS

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

This SAM template creates an S3 bucket and SQS queue. S3 writes a messages to the SQS queue 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-sqs

Deploy

sam deploy --guided


Testing

1. Upload an object to the S3 bucket created by the deployment.
2. In the console, check the SQS queue created by the deployment for new messages containing the S3 event.
3. You can also use the SQS CLI to fetch new messages from the queue: aws sqs receive-message --queue-url QUEUE_URL --max-number-of-messages 10.

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:

Talia Nasi

Talia Nasi

Talia is a Senior Developer Advocate at AWS.