0

I created a cloudformation template for sending notification mail if the Codebuild is failed. My template is working as expected. One thing is I need to add more than 1 mail ID (Will be given as parameter, not hardcoded in the template file) for receiving notification.

For that I given "mailid1, mailid2" "mailid1 mailid2" as subscription endpoint. But both the scenarios it does not create the CF stack and it returns an error. I have used the template file as attached. Could someone please confirm how to configure more than 1 mail id for SNS subscription ?

Kivi
  • 485
  • 1
  • 9
  • 26
  • You need multiple `SNSSubscription` resources. – luk2302 Jun 18 '21 at 11:07
  • 1
    Does this answer your question? [How to create variable number of EC2 instance resources in Cloudformation template?](https://stackoverflow.com/questions/5251934/how-to-create-variable-number-of-ec2-instance-resources-in-cloudformation-templa) – luk2302 Jun 18 '21 at 11:08
  • I tried creating multiple SNSSubscription and it shows the error "Invalid parameter: Endpoint (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: d5ddc19a-1306-5c4c-ace9-98dc99b533b8; Proxy: null" – Kivi Jun 18 '21 at 12:48
  • It is working in this way, but the requirement they confirmed like the parameter should use split function and use the mail id. I tried using split function and its not working. Could you please confirm with some examples, how to use split inside cloudformation template ? – Kivi Jun 21 '21 at 10:31
  • You basically don't. Honestly: that is one of the reasons you should not really use cloudformation but e.g. terraform. You can always create custom resources to create your custom logic. – luk2302 Jun 21 '21 at 10:49
  • How could this be performed with the above mentioned template file ? any inputs ? – Kivi Jun 21 '21 at 12:53
  • It can't. You cannot have a dynamic number of resources in cloudformation. End of story. – luk2302 Jun 21 '21 at 12:54

0 Answers0