Search code examples
amazon-web-servicesamazon-s3yamlaws-cloudformationamazon-sqs

Property 'Queue' cannot be empty


This is my first StackOverflow post, so sorry if the formatting is poor.

I could really use a second pair of eyes on my CloudFormation template. I am currently trying to wire up an SQS to alert whenever any object is created in my S3 bucket. I keep getting the error Property Queue cannot be empty, (even though it isn't). I've tried putting the ARN in single quotes, double quotes, no quotes, and nothing works. I have most recently tried to create a QueuePolicy for it and that just made it worse...

  rS3SqsTriggerDummy:
    DependsOn: rS3SqsTriggerPolicyQA
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Sub
          - "${bucketName}"
          - { bucketName: !FindInMap [Stage, !Ref StageName, bucketName]}
      NotificationConfiguration:
          QueueConfigurations:
          - Event: 's3:ObjectCreated:*'
          - Filter: 
                S3Key:
                  Rules:
                      Name: prefix
                      Value: 'dummy/'
            Queue: arn:aws:sqs:us-east-1:958262988361:interstate-claire-dummy-trigger-qa

If someone could take a look and give me some feedback, I'd be eternally grateful! Thanks in advance.


Solution

  • The AWS::S3::Bucket QueueConfiguration has the form of:

      QueueConfigurations: 
        - QueueConfiguration
    

    This means that QueueConfigurations is a list of QueueConfiguration, where QueueConfiguration is an object with Event, Filter and Queue properties. Thus QueueConfigurations should be (note only one -):

      NotificationConfiguration:
              QueueConfigurations:
                - Event: 's3:ObjectCreated:*'
                  Filter: 
                    S3Key:
                      Rules:
                        - Name: prefix
                          Value: 'dummy/'
                  Queue: arn:aws:sqs:us-east-1:958262988361:interstate-claire-dummy-trigger-qa
    

    Please be careful about indentation. Copying and pasting from SO may require reformatting.