Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions aws/s3/s3_event_notification_to_sqs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Validate Template

`aws cloudformation validate-template --template-body file://s3_event_notification_to_sqs.yaml`

# Create Stack

`aws cloudformation create-stack --stack-name s3-event-notification-to-sqs --template-body file://s3_event_notification_to_sqs.yaml`

# Update Stack

`aws cloudformation updatestack --stack-name s3-event-notification-to-sqs --template-body file://s3_event_notification_to_sqs.yaml`

# Delete Stack

`aws cloudformation create-stack --stack-name s3-event-notification-to-sqs`
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
AWSTemplateFormatVersion: '2010-09-09'

Resources:

S3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: sqs-notification-bucket
NotificationConfiguration:
QueueConfigurations:
- Event: s3:ObjectCreated:*
Queue: !GetAtt IngestQueue.Arn

IngestQueue:
Type: AWS::SQS::Queue
Properties:
RedrivePolicy:
deadLetterTargetArn: !GetAtt BulkIngestDeadLetterQueue.Arn
maxReceiveCount: 5
QueueName: !Sub bulk-ingest

BulkIngestDeadLetterQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: bulk-ingest-dlq

BulkIngestQueuePolicy:
Type: AWS::SQS::QueuePolicy
Properties:
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service: s3.amazonaws.com
Action:
- SQS:SendMessage
Resource: !GetAtt IngestQueue.Arn
Condition:
ArnLike:
# note that the bucket ARN defined below may need to be created using
# a format such as arn:aws:s3:::bucket_name
# in order to avoid a circular dependency
# this is untested
aws:SourceArn: arn:aws:s3:*:*:sqs-notification-bucket
StringEquals:
aws:SourceAccount: !Ref AWS::AccountId
Queues:
- !Ref IngestQueue