THE SIMPLE NOTIFICATION SERVICE (SNS)
The Simple Notification Service according Amazon’s Web Service is a messaging platform that provides message delivery from publishers to subscribers (also known as producers and consumers).
The Simple Notification Service is very good service when it comes to microservices. It can be used to receive published messages from supported AWS service endpoints like Lambda, Kinesis Data Firehose, AWS SQS and few more.
1. CONFIGURE SIMPLE NOTIFICATION SERVICE
- Navigate to the SNS dashboard. There, click on the orange colored Create Topics button.
- In the window, select the options according to your used case.
The FIFO will deliver messages in a queue, with exactly-once delivery of messages.
The Standard will deliver at least once.
- Fill in the Name and optional Display name of your topic.
- Select the Enable encryption to secure your message.
- Select the Basic Access Policy in the Access policy option.
- Choose Only The Topic Owner under who can publish.
- Select Everyone under who can subscribe to topic.
- In the delivery status logging, under IAM role, choose the Create new Service Role.
- In the new popped window, leave the default setting and click Create role.
Return to the SNS tab. Select the create SNS role for successful deliveries and failed deliveries.
- Tag your topic.
Click Create Topic.
2. CREATE A SUBSCRIPTION
Having created the SNS topic, you can the create a Subscription for the topic.
- Click on the created topic. Scroll down to find the create Subscription.
- Select the topic ARN from the dropdown list.
- Select SMS from the dropdown for the protocol. Choose the Sandbox phone number. If it is a new phone number, you will further configure the country code, and language for the number.
You will receive an authentication code in case of newly added number.
- Return to the Subscription page and select the newly added number from the Endpoint dropdown.
- Leave the Filter policy and the Redrive policy (dead-letter queue) as default.
Click Create Subscription.
3. PUBLISH AN SNS TO A PHONE NUMBER.
Once you have created the subscription, you can then publish a message to the configured phone number.
- Click the Publish Message from the Topic you created.
- Enter the Subject of the message.
Test SNS Publish.
- Select the Identical Payload For All Delivery Protocols option.
Enter your message in the text box.
This is just a test of SNS in AWS. If you get the message you have successfully configured AWS Simple Notification Service .
- In the attributes, select the String. Enter a name, and Value in the value.
Click Publish Message and wait for the message delivery on the phone number provided.
And that is it. You have published your SNS topic using SMS and also received it on your designated phone number.
You may also want to checkout my post on how to resize Elastic Block Storage in 3 Steps