Learn how to send SNS AWS message in 10 minutes
Published: 2023-07-11 15:54:48


Here's a 10-minute tutorial on how to send a message using Amazon SNS (Simple Notification Service). 
SNS is a flexible and scalable messaging and notification service that allows you to send messages through different channels, such as email, SMS, HTTP/S and more.

Step 1: Configuring Amazon SNS

a.	Log in to the Amazon SNS console in your AWS (Amazon Web Services) account.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i0hnult3nh2mfwypi4na.png)

 

b.	Create a new topic in SNS. This will act as a channel for sending and receiving messages.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7b6xffjiahpbdw3t0whu.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ypjo2d6ysl87r12cat0.png)
 

c.	Once the topic is created, write down the topic's ARN. The ARN is a unique identifier that you will need later to post messages to that topic.
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3y883r5pxrmqhi6l37t8.png)





Step 2: Creation of a subscription

a.	Within the topic you created, click on "Create subscription".

 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8lwpeittgsm47r1bk3yu.png)



b.	Select the protocol through which you wish to receive the messages, for example, email, text message (SMS), etc. In our case we selected SMS.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kcvtragmg1j2mf2ypoxf.png)



c.	Enter the necessary details for the selected protocol, such as e-mail address or telephone number.
d.	Confirm the subscription by following the instructions provided on the chosen platform. For example, if you selected email, check your inbox and follow the confirmation link sent by SNS.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cauuaezwc0g3b7nttsx9.png)


 

Step 3: Sending a message

a.	Go back to the main page of the topic in the SNS console.
b.	Click on "Post a message".

 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/42m555tev2sxsqpvvvu0.png)



c.	In the "Message" field, enter the content of the message you wish to send.
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mf25y553bnaiamd34ojh.png)





d.	Click on "Publish message".
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6rbsr6lcwnal02tza80.png)


You should receive something like this in your messenger service.
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ojl7z6347fq3vhgsdw87.png)



You're done! You have sent a message using Amazon SNS. The message will be delivered to all subscriptions configured for that topic. You can add more subscriptions as you need and send messages through different channels.
Remember that there are advanced configuration options in SNS, such as customizing messages, filtering subscriptions, and handling delivery confirmations and notifications. You can explore the official Amazon SNS documentation for more details on these additional features.
I hope you found this tutorial helpful. If you have any additional questions, feel free to ask.