0
votes

How to create and subscribe an Amazon SQS queue to an Amazon SNS topic in AWS CloudFormation?

  • SNS topic name = T1
  • SQS queue name = Q1

I need a template in JSON or YAML

Pease help me.

1
Does the Amazon SNS topic already exist, or do you wish to create it in the CloudFormation template too?John Rotenstein
i need to create that also @JohnRotensteinuser14055005

1 Answers

0
votes

Here is an example from Create a Subscription Between an Amazon SQS Queue and an Amazon SNS Topic in AWS CloudFormation:

Parameters:
  SNSTopicARN:
    Type: String
    Description: awsSNSTopicArnExample 
  TopicRegion:
    Type: String
    Description: us-east-1

Resources:
  Queue:
    Type: AWS::SQS::Queue

  SnsSubscription:
    Type: AWS::SNS::Subscription
    Properties:
      Protocol: sqs
      Endpoint: !GetAtt Queue.Arn
      Region: !Ref TopicRegion
      TopicArn: !Ref SNSTopicARN