Table of Contents
In this article, I will take you through the steps to create an Amazon SNS topic using AWS Management Console but before that let's understand how Amazon SNS service provides message delivery from publisher to subscriber using topics. The concept of topic is a very important one in Producer-Consumer System where Producer produces the messages and broadcast it to a logical channel called topic. Any of the AWS Services want to consume those messages has to subscribe to that topic first. After subscribing the endpoint begins to receive the messages published to the associated topic.
What is Amazon SNS
Amazon Simple Notification Service (Amazon SNS) is a managed service that provides message delivery from publishers to subscribers (also known as producers and consumers). More on official documentation.
What is Topic
An Amazon SNS topic is a logical access point that acts as a communication channel. A topic lets you group multiple endpoints (such as AWS Lambda, Amazon SQS, HTTP/S, or an email address).
Types of SNS Topic
There are two types of SNS topic:-
a) FIFO
- The ordering is based on first-in first-out basis.
- It has high throughput up to 300 publishes/second.
- It supports exactly once message delivery.
- It only supports SQL subscription protocol.
b) Standard
- The message ordering is based on best effort mechanism.
- It guarantees at least once message delivery.
- It has the highest throughput in publishes/second
- It supports wide range of subscription protocol like SQS, Lambda, HTTP, SMS, email, mobile application endpoints etc.
SNS Options and Settings
a) Encryption
By default, Amazon SNS provides in-transit encryption. You will also have the option to enable server side encryption along with the at-rest encryption to your topic.
b) Access Policy
Access Policy defines who can access your topic. By default, the owner who created the topic can only publish or subscribe to the topic.
c) Delivery Retry Policy(HTTP/S)
This policy is used to define how Amazon SNS retries failed deliveries to HTTP/S endpoints.
d) Delivery Status Logging
This option is used for configuring the logging of message delivery status to Cloudwatch logs.
How to Create an Amazon SNS Topic Using AWS Management Console
Also Read: Object Storage Vs Block Storage - Understanding the difference
Step 1: Prerequisites
a) You should have a valid AWS Account.
b) You should have sufficient IAM access to create resources in your account.
Step 2: Login to AWS Management Console
First you need to go to AWS Management Console login page and provide your credentials. Once given, Click on Sign In
.
Step 3: Open SNS Console
After successful authentication, you will land into AWS Management Console page. There you can search SNS service in the search box like below. Once the Simple Notification Service
shows up, you can click on it. It will take you to the SNS Console.
Step 4: Create a Topic
On SNS Dashboard, you can click on Create Topic to create your first SNS topic. Here you need to first provide a meaningful topic name. We are giving the name as ExampleTopic
. Then Click on Next Step
.
In the next window, you will be asked to choose the type of topic. You can either choose FIFO
or Standard
type. For now we are choosing Standard
type.
If you scroll down a bit, you will see a lot of other options to set. For example, you can set the Encryption, Access Policy, Delivery retry policy, Delivery Status logging etc.
You can choose to set any of these options as per your requirement and then Click on Create Topic
.
Wait for 1-2 mins for the topic to be created successfully. Once created, it will show like below.
Step 5: Delete a Topic
You can also choose to delete a topic in case it is no longer required. For example, here if you want to delete ExampleTopic
then you need to first select it and then Click on Delete
as shown below.
It will ask for confirmation by entering delete me in the confirmation box and then Click on Delete
.
After a moment, it will be successfully deleted as shown below.