multiple email subscription with cloud formation script

0

hi every one need help regarding cloud formation script I have created cloudformation script for alerts and which works fine I want to know how can I add multiple email address in this code if anyone knows and can help me will be thankful to him code his mention below

Parameters:
  sns:
    Type: String
    Default: Enter snstopic Name
    Description: Enter Your Sns Topic Name.
  EmailAdrs:
    Type: String
    Default: Enter Your Email Address
    Description: Enter Your Email Address.
  instancelist:
    Type: 'AWS::EC2::Instance::Id'
    Default: Select Your Instance
    Description: Select Your Instance from Dorpdown list.
  ThresHoldValue:
    Type: String
    Default: Enter ThresHold Value
    Description: Enter Value 100,90,80,70.
Resources:
  snstopic:
    Type: 'AWS::SNS::Topic'
    Properties:
      TopicName: !Ref sns
      Subscription:
        - Endpoint: !Ref EmailAdrs
          Protocol: email
  CloudWatchAlarm:
    Type: 'AWS::CloudWatch::Alarm'
    Properties:
      AlarmName: !Ref sns
      AlarmActions:
        - Ref: snstopic
      AlarmDescription: ES cluster CPU usage above 100%
      ComparisonOperator: GreaterThanThreshold
      TreatMissingData: notBreaching
      Dimensions:
        - Name: InstanceId
          Value: !Ref instancelist
      EvaluationPeriods: 1
      MetricName: CPUUtilization
      Namespace: AWS/ES
      Period: '60'
      Statistic: Sum
      Threshold: !Ref ThresHoldValue
1 Answer
0

The Subscription property of AWS::SNS::Topic resource accepts a list of subscriptions, so you can provide multiple subscriptions here (a list of Endpoint and Protocol combinations).

Alternatively, you can use AWS::SNS::Subscription resource type and then declare one for each email address that you need. This user guide contains sample template for an email endpoint https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html.

profile picture
joahna
answered 3 months ago
  • thanks for replying johna i did this but i want to add all address in online line with comma delemated without adding more endpoint

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