πŸ“¦ Day 26 of #90DaysOfCloud: Exploring SNS, SQS, and CloudWatch in AWS

Pratik DasPratik Das
4 min read

On Day 26, we dive into three essential services for communication, automation, and monitoring in the AWS ecosystem:

  • SNS (Simple Notification Service) – Push-based messaging

  • SQS (Simple Queue Service) – Queue-based messaging

  • CloudWatch – Monitoring, metrics, logs, and alarms

These tools are key for event-driven architectures, microservices, and automated cloud operations.


🌐 1. What is Amazon SNS?

Amazon SNS is a fully managed pub/sub messaging service. It enables applications, services, or users to send messages to multiple subscribers via topics.

πŸ”Ž Use Cases:

  • Sending email/SMS notifications

  • Alerting on system health

  • Broadcasting messages to multiple endpoints (Lambda, SQS, HTTP, etc.)


πŸ› οΈ Setting up SNS

βœ… Step 1: Create an SNS Topic

  1. Go to Amazon SNS β†’ Topics β†’ Create topic

  2. Choose Standard type

  3. Name your topic, e.g., SystemAlerts

  4. Click Create topic

βœ… Step 2: Add a Subscription

  1. Open your topic > Click Create subscription

  2. Choose protocol:

    • Email for testing

    • SQS, Lambda, or HTTP for integrations

  3. Enter your email address (if email) and create

βœ… You’ll receive a confirmation email β€” click the link to confirm the subscription.

βœ… Step 3: Publish a Message

  1. Open the topic > Publish message

  2. Enter a subject and message body

  3. Click Publish

Check your email inbox for the message!


πŸ“© 2. What is Amazon SQS?

Amazon SQS is a fully managed message queue service that enables decoupling and asynchronous communication between microservices.

πŸ”Ž Types of Queues:

  • Standard Queue: Best-effort ordering, high throughput

  • FIFO Queue: Exactly-once processing, ordered delivery


πŸ› οΈ Setting up SQS

βœ… Step 1: Create a Queue

  1. Go to Amazon SQS β†’ Create Queue

  2. Choose Standard or FIFO

  3. Name the queue (e.g., MyQueue)

  4. Click Create Queue

βœ… Step 2: Send a Message

  1. Open your queue > Send and receive messages

  2. Type a message (e.g., Hello from Day 26)

  3. Click Send message

βœ… Step 3: Receive and Delete Message

  1. In same section, click Poll for messages

  2. Click on the message > View > Delete

πŸ“ You can also integrate SQS with SNS to fan out messages.


πŸ“Š 3. What is Amazon CloudWatch?

CloudWatch helps you monitor AWS resources like EC2, RDS, Lambda, etc. It collects logs, tracks metrics, sets alarms, and triggers actions automatically.


πŸ› οΈ CloudWatch Hands-on Guide

βœ… Step 1: View EC2 Metrics

  1. Go to CloudWatch > Metrics

  2. Choose EC2 > Per-Instance Metrics

  3. Monitor CPUUtilization, NetworkIn/Out, etc.

βœ… Step 2: Set Up an Alarm

  1. Go to Alarms β†’ Create Alarm

  2. Select metric (e.g., EC2 > CPUUtilization)

  3. Set threshold (e.g., > 60% for 2 datapoints)

  4. Choose action β†’ Send notification via SNS

  5. Name and Create alarm

Now when CPU exceeds threshold, you’ll get a notification.


βœ… Step 3: Enable CloudWatch Logs (Optional)

For EC2 (Amazon Linux):

sudo yum install -y awslogs
sudo systemctl start awslogsd
sudo systemctl enable awslogsd.service

Edit the AWS Logs config at:

sudo vim /etc/awslogs/awslogs.conf

Add log group, log stream, and restart the agent.


πŸ’‘ Key Differences (SNS vs SQS)

FeatureSNSSQS
ModelPub/SubMessage Queue
DeliveryPushPull
SubscribersMultipleSingle or fan-out via SNS
LatencyLowSlight delay (polling)

🧠 Summary

ServicePurpose
SNSPush notifications to multiple services
SQSQueue-based, decoupled communication
CloudWatchMonitoring, metrics, logging, alarms

πŸ“… What’s Next?

Tomorrow is Day 27 β†’ We’ll dive into AWS RDS (Relational Database Service):

  • Creating and managing RDS instances

  • Connecting RDS to EC2

  • Backups, snapshots, and failover

  • Understanding storage types and pricing

Stay tuned to learn how AWS handles fully managed databases at scale!

0
Subscribe to my newsletter

Read articles from Pratik Das directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Pratik Das
Pratik Das