How to Create & Configure SImple Notification Service(SNS) on Amazon Web Service(AWS).

Amazon SNS is a highly available, durable, secure, fully managed pub/sub messaging service.It enablesĀ  decouple microservices, distributed systems, and event-driven serverless applications.

Amazon SNS topic owners can set topic policies that restrict who can publish and subscribe to a topic. Amazon SNS also ensures that data is encrypted in transit and at rest, and provides VPC endpoints for message privacy.

 

  • Login to aws portal.
  • Click on Services.

 

Fig 1

 

  • Under Application Integration select Simple Notification Service.

 

Fig 2

 

  • Provide Topic Name.
  • Click on Next step.

 

Fig. 3

 

  • Select Topic type:FIFO(first-in,first-out) or Standard.Ā Standard provide at-least-once message delivery, which means that each message is delivered at least once.
  • FIFO provide exactly-once message delivery, which means that each message is delivered once and remains available until a consumer processes it and deletes it.
  • Provide display name.

 

Fig. 4

 

  • Amazon SNS provides in-transit encryption.

 

Fig. 5

 

  • We can add Access policy for Amazon SNS.
  • Select Access policy method.
  • Select permission who can send message.
  • Select permission who can create or use subscribe.

 

Fig. 6

 

  • In case any message can be failed. Use delivery retry policy.

 

Fig. 7

 

  • Select Delivery status logging. Use any protocol which is used for send logs to CloudWatch.

 

Fig. 8

 

  • Create or select exisitng service role.
  • Provide tag key name & value.
  • Click on Create Topic.

 

Fig 9

 

  • Topic created successfully.
  • We needs to create subscribe an endpoint to an Amazon SNS topic.
  • Then Click on Publish message.

 

Fig 10

 

  • Provide Subject name.
  • Provide the number of seconds that push notification service has to deliver message to the endpoint.

 

Fig 11

 

  • Provide Message body, Type the content of message or message body to send to endpoint.

 

Fig 11

 

  • Provide Message attributes.
  • Click on Publish message.

 

Fig 12

 

  • After sometime message published to topic successfully.

 

Fig 13

 

Create Amazon SNS using Shell

To create Amazon SNS Topic

aws sns create-topic –name topic –attributes <value>

To publish a message to a topic

aws sns publish –topic-arn “arn:aws:sns:us-west-2:123456789012:topic-name”Ā  –message /path/of/message.txt

Contents of message.txt:

Hello World

 

Leave a Reply