Amazon Web Services (AWS) - Subscribe to a Simple Notification Service (SNS) Topic using the AWS CLI
by
Jeremy Canfield |
Updated: August 03 2023
| Amazon Web Services (AWS) articles
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
A Simple Notification Service (SNS) Topic can be used to create notification alerts, such as an email notification. This uses the messaging services pub sub model.
- pub (publish) - create a new alert in a Topic
- sub (subscribe) - get alerts in a Topic
Before setting up sub (subscribers), you will to create an SNS Topic. Check out my article on Creating a Simple Notification Service (SNS) Topics using the AWS CLI.
~]$ aws sns create-topic --name my-topic
{
"TopicArn": "arn:aws:sns:us-east-1:123456789012:my-topic"
}
The aws sns subscribe command can be used to subscribe to a Topic.
~]$ aws sns subscribe --topic-arn arn:aws:sns:us-east-1:123456789012:my-topic --protocol email --notification-endpoint john.doe@example.com
{
"SubscriptionArn": "pending confirmation"
}
Did you find this article helpful?
If so, consider buying me a coffee over at