Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to add multiple email to sns subscription

I am trying to add multiple email address in cdk code for sns subscription but getting error as Invalid parameter email address. When i tried with one email address then it works without issue.

// Adding an SNS action and an email registration 
const notificationsTopic = new Topic(this, 'Topic'); 
numFailedJobsAlarm.addAlarmAction(new SnsAction(notificationsTopic));
notificationsTopic.addSubscription(new EmailSubscription('rd@bak.de, ak@bak.de')); 

How can i add multiple email address in sns subscription ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

An SNS email subscription has a single email target. If you want to target more than one email, you need to create more than one subscription.

const emails = ['rd@bak.de', 'ak@bak.de'];

emails.forEach((email) => {
    notificationsTopic.addSubscription(new EmailSubscription(email));
});
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading