Bulk Import Subscription to AWS SNS Topic
1 min readMar 9, 2020
AWS SNS currently does not have a bulk import option for adding subscriptions.
Please remember AWS SNS API throttling Limits before implementing this.
The possible workaround is as follows:
Prerequisites
- awscli
- Access and Secret Keys
- terminal
Create a file company.txt and the endpoints for example lets say you want to subscribe phone numbers of your employees in the company.
$ company.txt+11111111111+11111111112+12222222222+12222222221
2. Open a terminal and run the following command by replacing the topic-arn with your topic ARN.
while read line; do aws sns subscribe — topic-arn <TOPIC_ARN> — protocol sms — notification-endpoint $line; done < company.txt
PowerShell:ForEach ($file in (Get-Content -Path company.txt
)) {aws sns subscribe — topic-arn <TOPIC_ARN> — protocol sms — notification-endpoint $file}
Then you can check it in the AWS SNS Console. You will see the subscription registered.