Sitemap

AWS Hands-On | SNS

7 min readJul 29, 2025

--

๐Ÿ“Œ Notice

This is a hands-on tutorial accompanying the blog post:

โ€œPass the AWS Certified Solutions Architect Associate Certification SAA-C03-(Episode 15: AWS Decoupling Applications)โ€

๐Ÿ”น Episode 15: AWS Decoupling Applications Theory & Hands โ€” On & CDK

๐Ÿ”น Episode 15: AWS Cloud Practitioner Quiz

๐Ÿ”น Episode 15: AWS Solution Architect Preparation Quiz

๐Ÿ”นAWS SNS Theory โ€” Click Here

๐Ÿ”นAWS SNS Hands-On โ€” Click Here

๐Ÿ”นAWS SNS CDK โ€” Click Here (Will update soon)

Use Case 1 : Simple SNS

๐Ÿ”น Step 1: Create an SNS Topic

  1. Log in to the AWS Console, and go to the Simple Notification Service (SNS).
  2. Click on โ€œTopicsโ€ in the left sidebar.
  3. Click โ€œCreate topicโ€.
  4. Choose the Topic type:
  • Select Standard (high throughput, best-effort ordering, at-least-once delivery).
  • You could also select FIFO if you need strict ordering and exactly-once delivery (requires .fifo suffix).

5. Enter a name for your topic โ€” e.g., MyFirstTopic.

6. Optional:

  • Enable encryption using AWS KMS if needed.
  • Access policy: Leave this as default unless you need cross-account or service-to-service access.

7. Click โ€œCreate topicโ€.

Press enter or click to view image in full size
Initial Page
Press enter or click to view image in full size
Create topic top page
Press enter or click to view image in full size
Create topic bottom page

โœ… Done! Your topic is ready.

๐Ÿ”น Step 2: Create a Subscription (Using Email)

  1. In your newly created topic page, click โ€œCreate subscriptionโ€.
  2. Choose Protocol: Select Email.
  3. Enter Endpoint: Input the email address you want to subscribe (e.g., issackpaul95@gmail.com).
  4. Optional:
  • Subscription filter policy: This lets you filter messages that specific subscribers receive โ€” skip it for now.

5. Click โ€œCreate subscriptionโ€.

Press enter or click to view image in full size
Fresh page of create SNS topic
Press enter or click to view image in full size
Option for select protocol
Press enter or click to view image in full size
enter endpoint
Press enter or click to view image in full size
After created subscription

โœ… Your subscription is created, but itโ€™s in โ€œPending confirmationโ€ status.

๐Ÿ”น Step 3: Confirm the Subscription

  1. Open your email and access the inbox.
  2. Open the confirmation email from AWS SNS.
  3. Click โ€œConfirm subscriptionโ€.
Press enter or click to view image in full size
Before confirmation
Press enter or click to view image in full size
Mail message
When confirmed in the mail
Press enter or click to view image in full size
After confirmation

๐Ÿ”„ Go back to the AWS Console and refresh the subscription page. You should now see the status as โ€œConfirmedโ€.

๐Ÿ”น Step 4: Publish a Message

Now letโ€™s send a message to test the SNS topic!

  1. In the MyFirstTopic page, click โ€œPublish messageโ€.
  2. Fill in:
  • Subject: e.g., Test Notification
  • Message body: e.g., Hello, world!

3. Leave other options as default.

4. Click โ€œPublish messageโ€.

Press enter or click to view image in full size
publish message top page
Press enter or click to view image in full size
publish message bottom page
Press enter or click to view image in full size
Received mail

๐Ÿ’ก Within seconds, you should receive the message in the email inbox you subscribed.

๐Ÿ”น Step 5: Clean Up (Optional but Recommended)

Once done testing, itโ€™s good practice to clean up:

  1. Delete the subscription:
  • Go to your topic โ†’ Subscriptions tab.
  • Select the subscription and click โ€œDeleteโ€.

2. Delete the topic:

  • Go back to Topics.
  • Select MyFirstTopic.
  • Click โ€œDeleteโ€ and confirm by typing delete me.

โœ… Clean and tidy!

Use Case 2 : SNS + SQS โ€” Fan Out Pattern

This pattern allows you to broadcast a message to multiple SQS queues through a single SNS topic. Itโ€™s great for microservices and loosely coupled systems.

โœ… What Youโ€™ll Build:

  • One SNS topic
  • Two (or more) SQS queues
  • Both queues subscribed to the SNS topic

๐Ÿ”ธ Steps:

  1. Create SNS Topic
    If not already created, repeat Use Case 1 from Part 1 (e.g., MyFanoutTopic).
  2. Create SQS Queues
  • Go to Amazon SQS โ†’ Create queue
  • Choose Standard queue
  • Name the queue (e.g., QueueA, then repeat for QueueB)
  • Leave settings as default and Create queues
  • For Queue Hands-On โ€” Click Here
Press enter or click to view image in full size
Queue A & Queue B

3. Subscribe Queues to SNS Topic

  • Go back to your SNS topic (MyFanoutTopic) โ†’ Create subscription
  • Protocol: Amazon SQS
  • Endpoint: Select ARN of QueueA
  • Repeat for QueueB
Press enter or click to view image in full size
Subscribe QueueA to SNS Topic
Press enter or click to view image in full size
Subscribe QueueB to SNS Topic
Press enter or click to view image in full size
MyFanoutTopic with Subscriptions

4. Confirm Subscription Permissions
SNS needs permission to publish to SQS:

  • SNS sets this up automatically with access policies, but if it fails, manually edit the SQS access policy to allow the SNS topic ARN.

5. Publish a Test Message

  • Go to MyFanoutTopic โ†’ Publish message
  • Enter Hello Fan Out! and publish
  • Check QueueA and QueueB โ€” both should receive the message
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
QueueA โ€” Poll for messages
Press enter or click to view image in full size
QueueA Message

โœ… Success! Youโ€™ve implemented the SNS โ†’ SQS fan-out pattern.

Use Case 3: Create an SNS FIFO Topic

FIFO (First-In-First-Out) topics guarantee strict message ordering and exactly-once delivery โ€” ideal for financial or transactional systems.

๐Ÿ”ธ Steps:

  1. Go to SNS โ†’ Topics โ†’ Create topic
  2. Select FIFO topic
  3. Name it (must end with .fifo, e.g., MyFIFOTopic.fifo)
  4. Choose a Content-Based Deduplication option:
  • ON = deduplication based on message body
  • OFF = must provide MessageDeduplicationId on publish

5. Click Create topic

Press enter or click to view image in full size
create Topic

๐Ÿง  Note: Only SQS FIFO queues can subscribe to SNS FIFO topics.

Use Case 4: SNS FIFO + SQS FIFO โ€” Fan Out

Now letโ€™s connect a FIFO SNS Topic to multiple FIFO SQS Queues for an ordered fan-out system.

๐Ÿ”ธ Steps:

  1. Create FIFO SQS Queues
  • Go to SQS โ†’ Create queue
  • Type: FIFO
  • Name: Must end with .fifo, e.g., Queue1.fifo, Queue2.fifo
  • Enable content-based deduplication if preferred

2. Create FIFO SNS Topic

  • Repeat Use Case 3 above to create MyFIFOTopic.fifo

3. Subscribe FIFO Queues

  • Go to MyFIFOTopic.fifo โ†’ Create subscription
  • Protocol: Amazon SQS
  • Endpoint: Use ARN of Queue1.fifo, then repeat for Queue2.fifo

4. Publish a FIFO Message

  • Go to MyFIFOTopic.fifo โ†’ Publish message
  • Provide:
  • Message group ID (required, e.g., group1)
  • Message deduplication ID (if required)
  • Body: FIFO message test
  • Click Publish

๐ŸŽฏ Check the SQS FIFO queues โ€” the order and uniqueness will be preserved.

Use Case 5: SNS โ€” Message Filtering

With message filtering, subscribers only receive messages they care about, reducing noise and increasing efficiency.

โœ… What Youโ€™ll Build:

  • One SNS topic
  • Two SQS queues
  • Subscriptions with filter policies (e.g., messages tagged by eventType)

๐Ÿ”ธ Steps:

  1. Create SNS Topic (e.g., FilteredTopic)
Press enter or click to view image in full size

2. Create Two SQS Queues (check previous steps): OrderQueue, ShippingQueue

3. Subscribe Both Queues to Topic

  • Go to FilteredTopic โ†’ Create subscription
  • Protocol: Amazon SQS
  • Select OrderQueue ARN
  • Click โ€œCreate subscriptionโ€
Press enter or click to view image in full size

4. Add Filter Policy

  • Click on the OrderQueue subscription
  • Choose Edit subscription filter policy
  • Add filter:
{
"eventType": ["order"]
}
Press enter or click to view image in full size
  • Repeat for ShippingQueue:
Press enter or click to view image in full size
{
"eventType": ["shipping"]
}
Press enter or click to view image in full size

5. Publish a Message with Attributes

  • Go to FilteredTopic โ†’ Publish message
  • Enter a message body: Order created
  • Add Message Attribute:
  • Key: eventType
  • Type: String
  • Value: order
  • Click Publish

๐Ÿงช Only OrderQueue should receive this message.

Repeat with eventType: shipping โ€” now only ShippingQueue should get it.

To stay informed on the latest technical insights and tutorials, connect with me on Medium and LinkedIn. For professional inquiries or technical discussions, please contact me via email. I welcome the opportunity to engage with fellow professionals and address any questions you may have.

--

--

Minoltan Issack
Minoltan Issack

Written by Minoltan Issack

Senior Software Engineer | AWS Community Builder | Machine Learning Enthusiast | Backend Expert (Java) | Technical Blogger Sharing Scalable Systems Insights