AWS CloudFormation: How to create aws budget with multiple emails

0

I have a cloudformation template like this:

 Parameters:
     EmailList:
       Type: String
  
  Resources:
      Budget:
        Type: AWS::Budgets::Budget
        Properties:
          Budget:
            BudgetName: "my-test-budget"
          NotificationsWithSubscribers:
            - Notification:
                NotificationType: !Ref NotificationType
                ComparisonOperator: GREATER_THAN
                Threshold: !Ref WarningThreshold
              Subscribers:
                Address: !Ref EmailList

Here the EmailList is array of emailIds searated by comma(e.g: abc@gmail.com,hello123@gmail.com), hence cannot use !Ref EmailList directly, If I split the EmailList and assign it to Address

Address: !Split [",", !Ref EmailList] 

this is not working, as Address field is expecting only one email Id to be assigned at once.

Since EmailList is a user provided emails, splitting by index o(i.e.

 Address: !Select [0, !Split [",", !Ref EmailList]]

) wouldn't be helpful as this assigns only 0th emailId to Address, also, will not be knowing exactly how many email ids will be provided.

As the https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-budgets-budget.html assigns each email to individually to Address, but https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-notificationwithsubscribers.html#cfn-budgets-budget-notificationwithsubscribers-subscribers says subnscribers are list of subscribers, but its is expecting individual emailId to be provided.

How can we split and assign each emailId to Address field individually?

Pnayak
質問済み 1ヶ月前154ビュー
1回答
0

Hello.

"Subscribers" is "Array of Subscribers", so you need to do the following:
In other words, I think it is necessary to pass the email addresses one by one as parameters instead of separating them with commas.
Alternatively, there may be a workaround such as creating a mailing list and consolidating it into one email address.

Parameters:
    Email1:
      Type: String
    Email2:
      Type: String

 Resources:
     Budget:
       Type: AWS::Budgets::Budget
       Properties:
         Budget:
           BudgetName: "my-test-budget"
         NotificationsWithSubscribers:
           - Notification:
               NotificationType: !Ref NotificationType
               ComparisonOperator: GREATER_THAN
               Threshold: !Ref WarningThreshold
             Subscribers:
               - Address: !Ref Email1
                 SubscriptionType: EMAIL
               - Address: !Ref Email2
                 SubscriptionType: EMAIL
profile picture
エキスパート
回答済み 1ヶ月前
profile pictureAWS
エキスパート
レビュー済み 1ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ