Amazon S3 to Amazon SQS

Amazon S3 → SQS

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

This 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


Clone repo

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

Deploy

cdk deploy


Testing

1. Upload an object to the S3 bucket created by the deployment: aws s3 cp 'test_upload.txt' s3://
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: npx cdk destroy.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus".

Created by:

Jake Boggan

Jake Boggan

I'm an ML & Data Engineer with AWS Professional Services.