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
2개 답변
1

There is a workaround, by using custom resources to define SNS and subscribing emails instead.

By using the Lambda function as a custom resource, you can subscribe multiple endpoints through an input parameter. You can use this Lambda function as a custom resource in any AWS CloudFormation template.

Please find it : https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/subscribe-multiple-email-endpoints-to-an-sns-topic-by-using-a-custom-resource.html

AWS
답변함 10달 전
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
답변함 2년 전
  • thanks for replying johna i did this but i want to add all address in online line with comma delemated without adding more endpoint

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠