AWS SNS and load balancer
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Amazon Web Services (AWS) offers a variety of solutions that can help businesses scale and optimize their network architectures to better serve their customer base. Among these tools, AWS Simple Notification Service (SNS) and Elastic Load Balancing (ELB) stand out as essential services for managing communication and distributing incoming application traffic across multiple targets, such as Amazon EC2 instances.
AWS Simple Notification Service (SNS)
AWS Simple Notification Service (SNS) is a flexible, fully managed pub/sub messaging and mobile notification service. It is designed to decouple microservice applications and integrate distributed systems by enabling the delivery of messages or notifications to subscribing endpoints or clients.
Key Features:
- Publish/Subscribe Model: SNS follows the pub-sub messaging paradigm where messages are pushed to multiple subscribers simultaneously, which is ideal for broadcasting important events.
- Multiple Protocol Support: It supports several types of recipient endpoints such as HTTP/S, email, SMS, and Lambda.
- Fan-out Architecture: Messages published to a topic are immediately distributed to all the subscriptions belonging to that topic.
Technical Example:
Here is a basic example of how SNS can be used to send a notification:
- Create a Topic:
- Subscribe an Email Endpoint:
- Publish a Message:
Elastic Load Balancing (ELB)
AWS Elastic Load Balancing (ELB) distributes incoming application or network traffic across multiple targets, such as Amazon EC2 instances, containers, IP addresses, and Lambda functions. ELB can handle the varying load of your application traffic in a single Availability Zone or across multiple Availability Zones.
Key Features:
- High Availability: It automatically distributes incoming application traffic across multiple targets and Availability Zones.
- Fault Tolerance: ELB detects unhealthy instances and reroutes traffic to healthy instances until the unhealthy ones are restored.
- Scalability: It can automatically adjust its resources based on incoming application traffic.
Types of Load Balancers:
- Application Load Balancer (ALB): Best for HTTP and HTTPS traffic, providing advanced request routing targeted at delivery of modern application architectures, including microservices and containers.
- Network Load Balancer (NLB): Optimal for TCP traffic where performance is required.
- Classic Load Balancer (CLB): Provides basic load balancing at both L7 (Application Layer) and L4 (Transport Layer).
Technical Example:
Here’s a basic approach to setting up an Application Load Balancer:
- Create a Load Balancer:
- Define Listeners and Target Groups: Listeners check for connection requests, while Target Groups route requests to one or more registered targets.
Comparison Table
| Feature | AWS SNS | AWS ELB |
| Purpose | Messaging and Notifications | Traffic Distribution |
| Usage | Decouple systems, Push Notifications | Load balance traffic across EC2 instances |
| Protocols | HTTP/S, SMS, Email, Lambda | HTTP/S, TCP, UDP, TLS |
| Best Used For | Microservices, Alert Systems | High-traffic web applications |
AWS SNS and ELB are robust services that play crucial roles in the architecture of scalable, fault-tolerant cloud applications. While SNS focuses on message broadcasting and pub/sub functionalities, ELB concentrates on optimizing application performance and resource utilization through effective load distribution.

