- Priya
- September 13, 2022
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.
- Under Application Integration select Simple Notification Service.
- Provide Topic Name.
- Click on Next step.
- 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.
- Amazon SNS provides in-transit encryption.
- 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.
- In case any message can be failed. Use delivery retry policy.
- Select Delivery status logging. Use any protocol which is used for send logs to CloudWatch.
- Create or select exisitng service role.
- Provide tag key name & value.
- Click on Create Topic.
- Topic created successfully.
- We needs to create subscribe an endpoint to an Amazon SNS topic.
- Then Click on Publish message.
- Provide Subject name.
- Provide the number of seconds that push notification service has to deliver message to the endpoint.
- Provide Message body, Type the content of message or message body to send to endpoint.
- Provide Message attributes.
- Click on Publish message.
- After sometime message published to topic successfully.
Create Amazon SNS using Shell
- Setup aws-cli on your system so click on link https://www.hackerxone.com/blog/how-install-configure-aws-cli-ubuntu-1804
- Run the following command:
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