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


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
Go to Amazon SNS β Topics β Create topic
Choose
Standard
typeName your topic, e.g.,
SystemAlerts
Click Create topic
β Step 2: Add a Subscription
Open your topic > Click Create subscription
Choose protocol:
Email
for testingSQS
,Lambda
, orHTTP
for integrations
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
Open the topic > Publish message
Enter a subject and message body
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
Go to Amazon SQS β Create Queue
Choose
Standard
orFIFO
Name the queue (e.g.,
MyQueue
)Click Create Queue
β Step 2: Send a Message
Open your queue > Send and receive messages
Type a message (e.g.,
Hello from Day 26
)Click Send message
β Step 3: Receive and Delete Message
In same section, click Poll for messages
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
Go to CloudWatch > Metrics
Choose EC2 > Per-Instance Metrics
Monitor CPUUtilization, NetworkIn/Out, etc.
β Step 2: Set Up an Alarm
Go to Alarms β Create Alarm
Select metric (e.g., EC2 > CPUUtilization)
Set threshold (e.g., > 60% for 2 datapoints)
Choose action β Send notification via SNS
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)
Feature | SNS | SQS |
Model | Pub/Sub | Message Queue |
Delivery | Push | Pull |
Subscribers | Multiple | Single or fan-out via SNS |
Latency | Low | Slight delay (polling) |
π§ Summary
Service | Purpose |
SNS | Push notifications to multiple services |
SQS | Queue-based, decoupled communication |
CloudWatch | Monitoring, 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!
Subscribe to my newsletter
Read articles from Pratik Das directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
