CloudFormation Nonsense: Seven (7) SNS Subscriptions created for SQS Queues by a Template

0

Greetings!,

I have a nonsense CloudFormation behaviour, the problem is in the section where i create an SNS Topic and two SQS Queues in a typical Fan-out pattern:

Resources:
  ForwardMessageQueue:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: !Sub 'ForwardMessageQueue${EnvironmentPrm}'
      Tags:
        - Key: 'Environment'
          Value: !Ref EnvironmentPrm
  AuditMessageQueue:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: !Sub 'AuditMessageQueue${EnvironmentPrm}'
      Tags:
        - Key: 'Environment'
          Value: !Ref EnvironmentPrm

  CallbackNotificationTopic:
    Type: AWS::SNS::Topic
    Properties:
      TopicName: !Sub 'CallbackNotificationTopic${EnvironmentPrm}'
      Subscription:
        - Endpoint: !GetAtt ForwardMessageQueue.Arn
          Protocol: "sqs"
        - Endpoint: !GetAtt AuditMessageQueue.Arn
          Protocol: "sqs"
      Tags:
        - Key: 'Environment'
          Value: !Ref EnvironmentPrm

The template executes successfully and the solution once deployed, does what it has todo. The problem is when I checkout the configuration of the Queues through the AWS Web Console, I find seven SNS Subscriptions like:

Subscription ARNTopic ARN
arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev:cef23e99-12c6-4120-9219-bb4b7ac05ef4arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev
arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev:afdfc906-5b0d-41f0-9185-572b51fecaf5arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev
arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev:ab1ebde3-91b9-4567-a2b4-9613afefbbd7arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev
arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev:930edf3c-ccb4-4184-b263-32ee64136387arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev

... and other 3 rows more, seven rows in total.

Any idea of the cause of this misbehavior? Thanks in advanced!.

  • Today I created a very simple CloudFormation template just for the fan-out pattern (identical to the previous one, I just changed the logical names of the SNS Topic and SQS Queues), the result was as expected: one SNS subscription for every Queue. Exactly the same code in the real solution's template create seven SNS Topic subscriptions per SQS Queue, weird...

1 Answer
0

I launched your template (copied from your post) and couldn't reproduce the issue I'm afraid. If you are on an AWS support plan (i.e. Developer or higher) I'd suggest opening a support ticket as the support team can then investigate internally to see what the services are doing.

profile pictureAWS
EXPERT
James_S
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions