I am trying to set up a workflow with serverless that creates a new S3 bucket, a new SQS queue and when an object is created in the S3 bucket, puts a messages on the queue and spins up a lambda once there are enough messages on the queue. I have the following in my resources block:
resources:
Resources:
AnalyticsQueue:
Type: "AWS::SQS::Queue"
Properties:
QueueName: "my-queue"
S3EventQueuePolicy:
Type: AWS::SQS::QueuePolicy
DependsOn: AnalyticsQueue
Properties:
PolicyDocument:
Id: SQSPolicy
Statement:
- Effect: Allow
Action: sqs:SendMessage:*
Resource: !Ref AnalyticsQueue
Queues:
- !GetAtt AnalyticsQueue.Arn
AnalyticsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: "my-bucket"
NotificationConfiguration:
QueueConfigurations:
- Event: s3:ObjectCreated:*
Queue: !GetAtt AnalyticsQueue.Arn
When I try to deploy this I receive the following error:
An error occurred: AnalyticsBucket - Unable to validate the following destination configurations (Service: Amazon S3; Status Code: 400; Error Code: InvalidArgument; Request ID: E2A1F8BD6BEE6EF4;).
Some googling and I found that the issue is in the NotificationConfiguration
block on the AnalyticsBucket
. If I remove that whole sub-block, it deploys just fine but then obviously won't generate messages on the queue when objects get created.
Looking for a way to resolve this.