0% found this document useful (0 votes)
248 views7 pages

AWS EC2 Notes

Elastic Load Balancing routes traffic to registered targets like EC2 instances across Availability Zones to ensure availability. It monitors the health of targets and only routes traffic to healthy ones. Load balancers are configured with listeners that check for connection requests on specified protocols and ports. Cross-zone load balancing determines whether traffic is distributed across targets in all enabled Availability Zones or only within each Availability Zone.

Uploaded by

Shivam Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
248 views7 pages

AWS EC2 Notes

Elastic Load Balancing routes traffic to registered targets like EC2 instances across Availability Zones to ensure availability. It monitors the health of targets and only routes traffic to healthy ones. Load balancers are configured with listeners that check for connection requests on specified protocols and ports. Cross-zone load balancing determines whether traffic is distributed across targets in all enabled Availability Zones or only within each Availability Zone.

Uploaded by

Shivam Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

How Elastic Load Balancing Works

A load balancer accepts incoming traffic from clients and routes requests to its
registered targets (such as EC2 instances) in one or more Availability Zones.
The load balancer also monitors the health of its registered targets and
ensures that it routes traffic only to healthy targets. When the load balancer
detects an unhealthy target, it stops routing traffic to that target. It then
resumes routing traffic to that target when it detects that the target is healthy
again.

You configure your load balancer to accept incoming traffic by specifying one
or more listeners. A listener is a process that checks for connection requests. It
is configured with a protocol and port number for connections from clients to
the load balancer. Likewise, it is configured with a protocol and port number
for connections from the load balancer to the targets.

Elastic Load Balancing supports three types of load balancers:

 Application Load Balancers


 Network Load Balancers
 Classic Load Balancers

There is a key difference in how the load balancer types are configured. With
Application Load Balancers and Network Load Balancers, you register targets in
target groups, and route traffic to the target groups. With Classic Load
Balancers, you register instances with the load balancer.

Availability Zones and Load Balancer Nodes

When you enable an Availability Zone for your load balancer, Elastic Load
Balancing creates a load balancer node in the Availability Zone. If you register
targets in an Availability Zone but do not enable the Availability Zone, these
registered targets do not receive traffic. Your load balancer is most effective
when you ensure that each enabled Availability Zone has at least one
registered target.

We recommend that you enable multiple Availability Zones. (With an


Application Load Balancer, we require you to enable multiple Availability
Zones.) This configuration helps ensure that the load balancer can continue to
route traffic. If one Availability Zone becomes unavailable or has no healthy
targets, the load balancer can route traffic to the healthy targets in another
Availability Zone.

After you disable an Availability Zone, the targets in that Availability Zone
remain registered with the load balancer. However, even though they remain
registered, the load balancer does not route traffic to them.

Cross-Zone Load Balancing

The nodes for your load balancer distribute requests from clients to registered
targets. When cross-zone load balancing is enabled, each load balancer node
distributes traffic across the registered targets in all enabled Availability Zones.
When cross-zone load balancing is disabled, each load balancer node
distributes traffic only across the registered targets in its Availability Zone.

The following diagrams demonstrate the effect of cross-zone load balancing.


There are two enabled Availability Zones, with two targets in Availability Zone
A and eight targets in Availability Zone B. Clients send requests, and Amazon
Route 53 responds to each request with the IP address of one of the load
balancer nodes. This distributes traffic such that each load balancer node
receives 50% of the traffic from the clients. Each load balancer node distributes
its share of the traffic across the registered targets in its scope.

If cross-zone load balancing is enabled, each of the 10 targets receives 10% of


the traffic. This is because each load balancer node can route its 50% of the
client traffic to all 10 targets.
If cross-zone load balancing is disabled:

 Each of the two targets in Availability Zone A receives 25% of the traffic.
 Each of the eight targets in Availability Zone B receives 6.25% of the
traffic.

This is because each load balancer node can route its 50% of the client traffic
only to targets in its Availability Zone.
With Application Load Balancers, cross-zone load balancing is always enabled.

With Network Load Balancers, cross-zone load balancing is disabled by default.


After you create a Network Load Balancer, you can enable or disable cross-
zone load balancing at any time. For more information, see Cross-Zone Load
Balancing in the User Guide for Network Load Balancers.

When you create a Classic Load Balancer, the default for cross-zone load
balancing depends on how you create the load balancer. With the API or CLI,
cross-zone load balancing is disabled by default. With the AWS Management
Console, the option to enable cross-zone load balancing is selected by default.
After you create a Classic Load Balancer, you can enable or disable cross-zone
load balancing at any time. For more information, see Enable Cross-Zone Load
Balancing in the User Guide for Classic Load Balancers.

Request Routing

Before a client sends a request to your load balancer, it resolves the load
balancer's domain name using a Domain Name System (DNS) server. The DNS
entry is controlled by Amazon, because your load balancers are in
the amazonaws.com domain. The Amazon DNS servers return one or more IP
addresses to the client. These are the IP addresses of the load balancer nodes
for your load balancer. With Network Load Balancers, Elastic Load Balancing
creates a network interface for each Availability Zone that you enable. Each
load balancer node in the Availability Zone uses this network interface to get a
static IP address. You can optionally associate one Elastic IP address with each
network interface when you create the load balancer.

As traffic to your application changes over time, Elastic Load Balancing scales
your load balancer and updates the DNS entry. The DNS entry also specifies the
time-to-live (TTL) of 60 seconds. This helps ensure that the IP addresses can be
remapped quickly in response to changing traffic.

The client determines which IP address to use to send requests to the load
balancer. The load balancer node that receives the request selects a healthy
registered target and sends the request to the target using its private IP
address.

Routing Algorithm

With Application Load Balancers, the load balancer node that receives the
request uses the following process:

1. Evaluates the listener rules in priority order to determine which rule to


apply.
2. Selects a target from the target group for the rule action, using the
routing algorithm configured for the target group. The default routing
algorithm is round robin. Routing is performed independently for each
target group, even when a target is registered with multiple target
groups.

With Network Load Balancers, the load balancer node that receives the
connection uses the following process:

1. Selects a target from the target group for the default rule using a flow
hash algorithm. It bases the algorithm on:
 The protocol
 The source IP address and source port
 The destination IP address and destination port
 The TCP sequence number
2. Routes each individual TCP connection to a single target for the life of
the connection. The TCP connections from a client have different source
ports and sequence numbers, and can be routed to different targets.
With Classic Load Balancers, the load balancer node that receives the request
selects a registered instance as follows:

 Uses the round robin routing algorithm for TCP listeners


 Uses the least outstanding requests routing algorithm for HTTP and
HTTPS listeners

RDS –Notes
Amazon Aurora is not offered in free-tier.
To connect RDS instance with EC2 instance, allow your EC2 instance security
group to talk to the security group of EC2 instance.

Read Replicas:
For the MySQL, MariaDB, PostgreSQL, and Oracle database engines, Amazon
RDS creates a second DB instance using a snapshot of the source DB instance.
It then uses the engines' native asynchronous replication to update the read
replica whenever there is a change to the source DB instance. The read replica
operates as a DB instance that allows only read-only connections; applications
can connect to a read replica just as they would to any DB instance. Amazon
RDS replicates all databases in the source DB instance.

Multi-AZ Deployments and Read Replicas


Amazon RDS Multi-AZ deployments complement Read Replicas for Amazon
RDS for MySQL, MariaDB, and PostgreSQL. While both features maintain a
second copy of your data, there are differences between the two:

Multi-AZ Deployments Read Replicas

Synchronous replication – highly durable Asynchronous replication – highly scalable

Only database engine on primary instance is active All read replicas are accessible and can be used for read scaling

Automated backups are taken from standby No backups configured by default


Always span two Availability Zones within a single Region Can be within an Availability Zone, Cross-AZ, or Cross-Region

Database engine version upgrades happen on primary Database engine version upgrade is independent from source instanc

utomatic failover to standby when a problem is detected Can be manually promoted to a standalone database instance

Spot Instances
A Spot Instance is an unused EC2 instance that is available for less than the On-
Demand price. Because Spot Instances enable you to request unused EC2
instances at steep discounts, you can lower your Amazon EC2 costs significantly.
The hourly price for a Spot Instance is called a Spot price. The Spot price of each
instance type in each Availability Zone is set by Amazon EC2, and adjusted
gradually based on the long-term supply of and demand for Spot Instances. Your
Spot Instance runs whenever capacity is available and the maximum price per hour
for your request exceeds the Spot price.

Spot Instances are a cost-effective choice if you can be flexible about when your
applications run and if your applications can be interrupted. For example, Spot
Instances are well-suited for data analysis, batch jobs, background processing, and
optional tasks

Reserved Instances provide you with significant savings on your Amazon EC2 costs
compared to On-Demand Instance pricing. Reserved Instances are not physical instances,
but rather a billing discount applied to the use of On-Demand Instances in your account.
These On-Demand Instances must match certain attributes, such as instance type and
Region, in order to benefit from the billing discount.

You might also like