Search code examples
amazon-web-servicesaws-cloudformationamazon-sns

How to add multiple email address to a SNS topic via cloudformation?


is it possible to add more than one email address to a SNS topic subscription via cloudformation

SNSTopic:
   Type: AWS::SNS::Topic
   Properties:
    Subscription:
    - protocol:email
      Endpoint: abc@gmail.com

Solution

  • There are no loops in CFN. So you have to explicitly list all your email addresses:

    SNSTopic:
       Type: AWS::SNS::Topic
       Properties:
        Subscription:
        - protocol:email
          Endpoint: abc@gmail.com
        - protocol:email
          Endpoint: second@gmail.com
        - protocol:email
          Endpoint: third@gmail.com
    

    If you want to do it dynamically, you have to create your own macro or custom resource.