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?

1 Risposta
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
ESPERTO
con risposta un mese fa
profile pictureAWS
ESPERTO
verificato un mese fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande