I am trying to send notification on file creating in s3 to SQS.
I am still getting Resource handler returned message: "Unable to validate the following destination configurations (Service: S3, Status Code: 400) error.
My code is:
S3Bucket:
Type: 'AWS::S3::Bucket'
DependsOn:
- QueuePolicy
Properties:
BucketName: !Sub '${AWS::AccountId}-bucket'
NotificationConfiguration:
QueueConfigurations:
- Event: 's3:ObjectCreated:*'
Queue: !GetAtt Queue.Arn
QueuePolicy:
Type: 'AWS::SQS::QueuePolicy'
Properties:
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service: "s3.amazonaws.com"
Action:
- 'SQS:SendMessage'
Resource: !GetAtt Queue.Arn
Condition:
ArnLike:
aws:SourceArn: !Sub 'arn:aws:s3:::${AWS::AccountId}-bucket'
StringEquals:
aws:SourceAccount: !Ref AWS::AccountId
Queues:
- !Ref Queue
Queue:
Type: "AWS::SQS::Queue"
Properties:
DelaySeconds: 0
KmsMasterKeyId: alias/aws/sqs
KmsDataKeyReusePeriodSeconds: 300
QueueName: !Sub "${AWS::AccountId}-queue"
ReceiveMessageWaitTimeSeconds: 0
VisibilityTimeout: !Ref SQSVisibilityTimeout
MessageRetentionPeriod: 3600
RedrivePolicy:
deadLetterTargetArn:
Fn::GetAtt:
- "queueDLQ"
- "Arn"
maxReceiveCount: 3
found example here https://github.com/aws-samples/serverless-patterns/blob/main/s3-sqs/template.yaml but I can not make it work. What am I missing?