[go: up one dir, main page]

0% found this document useful (0 votes)
7 views90 pages

Module 2 1

Uploaded by

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

Module 2 1

Uploaded by

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

AWS Compute

Module 2
BCSE355L – AWS Solutions Architect
Title and content layout
▪ Compute
▪ Amazon EC2
▪ Amazon Pricing Model
▪ Auto Scaling
▪ Elastic Load Balancing
AWS Compute
Compute in AWS

▪ Running your application code or database was about servers


with a CPU attached. These servers could be dedicated to
physical bare-metal machines or VMs hosted on physical
machines.
▪ The cloud started with the same concept of providing on-
demand servers, which are VMs hosted in cloud providers’ data
centers.
▪ In AWS terminology, these servers, called Amazon Elastic
Compute Cloud (EC2), are on-demand VMs available based on
a per-second billing model.
Compute in AWS

▪ With EC2, AWS takes care of the physical server, but there is still a
maintenance overhead involved in patching and securing the underlying
OS in these EC2 instances.
▪ AWS are looking to provide more optimized solutions and help you focus
on the coding part to build business logic.
▪ AWS launched a serverless compute service called AWS Lambda to reduce
OS maintenance overhead in 2014.
▪ write a piece of code and run it using the service without worrying about servers and
clusters, which generated the term function-as-a-service (FaaS).
▪ Lambda pointed the direction of building compute services without
servers.
▪ Lambda still runs on servers behind the scenes, but that is abstracted
from the end-user, resulting in the term serverless compute.
Compute in AWS

▪ AWS Fargate, launched in 2017 for Elastic Container Service


(ECS), which allows the customer to run their Docker containers
in AWS without a server.
▪ In 2019, Fargate launched Elastic Kubernetes Service (EKS) to
allow customers to run Kubernetes serverless.
▪ In 2020, they launched various serverless options for analytics
services,
▪ Amazon Redshift Serverless for building petabyte-scale data
warehouses in the cloud without a server,
▪ Elastic MapReduce (EMR) Serverless for transforming terabytes of data
using a serverless Hadoop system in the cloud
▪ Managed Streaming for Kafka (MSK) Serverless for running Kafka
workloads in the cloud without worrying about the server.
AWS Compute services

▪ AWS provides clues about instance families through their


naming convention, which indicates the key characteristics of
the instance family.
▪ These are prefixes or postfixes for various instance types:
▪ a – AMD processors
▪ g – AWS Graviton processors
▪ i – Intel processors
▪ d – Instance store volumes
▪ n – Network optimization
▪ b – Block storage optimization
▪ e – Extra storage or memory
▪ z – High frequency
Categories Compute services

▪ AWS provides clues about instance families through their


naming convention, which indicates the key characteristics of
the instance family.
▪ These are prefixes or postfixes for various instance types:
▪ a – AMD processors
▪ g – AWS Graviton processors
▪ i – Intel processors
▪ d – Instance store volumes
▪ n – Network optimization
▪ b – Block storage optimization
▪ e – Extra storage or memory
▪ z – High frequency
Amazon EC2
Amazon EC2

▪ Amazon EC2 is
▪ AWS’s way of naming servers.
▪ Virtual machines hosted on a physical server residing inside the
AWS data center in a secure environment.
▪ Standardizing infrastructure management, security, and growth,
and building an economy of scale to quickly meet client demand
for services in minutes.
▪ can shut off access to resources with the same speed and agility as
when you requested and started the resources, with an accompanying
reduction in the billing for these resources
Amazon EC2

▪ Amazon EC2 is
▪ Delivers a large variety of instance types.
▪ Each type addresses different needs and is optimized to fit a specific
use case.
▪ Instance types are defined by a combination of their memory, CPU,
GPU, storage, and networking capabilities
Amazon EC2

▪ Amazon EC2 is
▪ Delivers a large variety of instance types.
▪ Each type addresses different needs and is optimized to fit a specific
use case.
▪ Instance types are defined by a combination of their memory, CPU,
GPU, storage, and networking capabilities
Amazon EC2

▪ Advantages of EC2
▪ The diverse set of instances to choose from
▪ Offers more than 400 instances
▪ Enable customers to run virtually every workload.
▪ Ex. You can choose T3 instance (single processor) to C5 instance (96
processors), Memory 100Mb (T3 instance) to 24 TB(High Memory
Instances), Network 1GB (T2 instance) to 100 GB (Elastic Fabric
Adapter)
▪ Can bulit extreme low-latency NVMe and massively scaled remote and
block-level storage using Elastic Block Store.
▪ Eight peer-to-peer (P3 instance) connected GPU
▪ Dedicated FGPA (F1 instances), macOS (M5 instance), High
performance computing
Amazon EC2

▪ Advantages of EC2
▪ Scalability
▪ EC2 offers auto-scaling.
▪ Auto-scaling helps to scale out EC2 instances automatically
based on defined metrics.
▪ For example, you can add two EC2 instances if your instance
memory utilization reaches 60% or CPU utilization reaches 70%.
You can learn more about auto-scaling in the AWS docs at
https://aws.amazon.com/autoscaling/.
Amazon EC2

▪ Advantages of EC2
▪ Performance
▪ AWS Nitro gives EC2 significant and unique performance
advantages
▪ Hypervisor between the physical hardware and the virtual system.
This abstraction layer provides flexibility and ease of use but can
also negatively impact performance
▪ Nitro hypervisor has been optimized for cloud instances,
improving performance characteristics.
▪ Nitro takes many networks, storage, security, and system
management functions.
Amazon EC2

▪ Advantages of EC2
▪ Reliability
▪ EC2 is built on 24 Regions and over 76 global Availability Zones and
serves millions of customers ranging from large enterprises to
start-ups. EC2 has an SLA commitment of 99.99% availability for
each Region. Overall, this makes AWS EC2 very reliable.
▪ Security
▪ Client systems that are allowed to connect to EC2 must also meet
strict security standards such as PCI, SOC, and FedRAMP.
▪ Can create entire networks under IPsec to define a logically
isolated section of AWS using a Virtual Private Network (VPN).
▪ https://aws.amazon.com/ec2/nitro/nitro-enclaves/.
EC2 instance families

▪ AWS provides more than 400 types of instances based on


processor, storage, networking, operating system, and purchase
model.
▪ As per your workload, AWS offers different capabilities,
processors, platforms, instances, and more.
▪ Instance types that Amazon offers:
▪ General Purpose (A1, M6, T4, Mac)
▪ Compute Optimized (C7, Hpc6a)
▪ Accelerated Computing (P4, G5, F1)
▪ Memory Optimized (R6, X2, High Memory)
▪ Storage Optimized (H1, D3, I4)
EC2 instance families

▪ AWS provides clues about instance families through their


naming convention, which indicates the key characteristics of
the instance family.
▪ These are prefixes or postfixes for various instance types:
▪ a – AMD processors
▪ g – AWS Graviton processors
▪ i – Intel processors
▪ d – Instance store volumes
▪ n – Network optimization
▪ b – Block storage optimization
▪ e – Extra storage or memory
▪ z – High frequency
EC2 instance families

▪ AWS provides clues about instance families through their


naming convention, which indicates the key characteristics of
the instance family.
▪ These are prefixes or postfixes for various instance types:
▪ a – AMD processors
▪ g – AWS Graviton processors
▪ i – Intel processors
▪ d – Instance store volumes
▪ n – Network optimization
▪ b – Block storage optimization
▪ e – Extra storage or memory
▪ z – High frequency
EC2 instance - General Purpose (A1, M6, T4, Mac)

▪ General Purpose instances balance CPU, memory, and network


resources, providing a balance between cost and functionality.
▪ They are ideal for running web servers, containerized microservices,
caching fleets, and development environments.
▪ Class is between instances with fixed (such as M5a) and burstable
(such as T3a) performance.
▪ T family instance types include T2/T3/T4 EC2 instances.
▪ AWS provides t2.micro for free
▪ T4g uses a Graviton 2 processor, the T2/T3 family uses Intel chips, and
T3a uses AMD chips with burstable performance.
▪ A burstable instance is the t2.small instance, which is designed for
workloads that do not require a consistently high level of CPU
performance
EC2 instance - General Purpose (A1, M6, T4, Mac)

▪ M family instance types include M4/M5/M6 EC2 instances, which


are similar to T family instances.
▪ General Purpose instances and deliver a good balance between
compute, memory, and network resources.
▪ Latest M6 instances are available across all three processors: Intel Xeon
(M6i instances), Graviton 2 (M6g instances), and AMD (M6a instances).
▪ A1 instances are the first EC2 instances powered by Graviton
processors.
▪ Offers good value for the amount of functionality supplied.
▪ Used in scale-out workloads.
▪ A1 instances use an Arm chip.
▪ Suitable for application development that runs open-source languages
such as Java, Ruby, and Python.
EC2 instance - General Purpose (A1, M6, T4, Mac)

▪ Mac instances are built on the AWS Nitro system and are powered
by Apple Mac mini computers with Intel Core i7-8700 processors.
▪ Have access to macOS to develop, test, and sign applications that
require Apple’s Xcode IDE.
EC2 instance - Compute Optimized (C7, Hpc6a)

▪ C series instances, are designed for applications that are highly


compute-intensive and require a high level of CPU performance.
▪ Equipped with powerful processors, such as Intel Xeon Scalable
processors, and offer a high ratio of CPU to memory to support
demanding workloads.
▪ Suited for a variety of workloads, including high-performance
computing (HPC) applications, video encoding and transcoding,
machine learning and deep learning, and other applications that require
a high level of CPU performance
▪ C7g instance - Graviton 3 processor,
▪ C6 instances - Intel Xeon (C6i instances), Graviton 2 (C6g/C6gn
instances), and AMD (C6a instances) processors
EC2 instance - Compute Optimized (C7, Hpc6a)

▪ Hpc6a instances are


▪ optimized for high-performance computing workloads
▪ Available in low-cost AMD processor
▪ delivers network performance upto 100 Gbps - Elastic Fabric Adapter
(EFA) for inter-node network bandwidth.
▪ These instances are designed for the following workloads:
▪ Molecular dynamics
▪ Weather forecasting
▪ Computational fluid dynamics
EC2 instance - Accelerated Computing (P4, G5, F1)

▪ Accelerated Computing instances include additional hardware


dedicated to the instance, such as GPUs.
▪ Provide massive amounts of parallel processing such as
▪ Graphics processing,
▪ Machine learning (both learning and inferencing),
▪ Computational storage,
▪ Encryption, and Compression.
▪ These instances have hardware accelerators that enable them to
evaluate functions, such as
▪ floating-point number calculations,
▪ graphics,
▪ modeling, and
▪ complex pattern matching
EC2 instance - Accelerated Computing (P4, G5, F1)

▪ P family instance types include


▪ P2 NVIDIA K80/P3 V100/P4 NVIDIA A100 Tensor Core instances
▪ Deliver high performance with up to 8 NVIDIA V100 Tensor Core GPUs
and up to 400 Gbps of networking throughput.
▪ P4 instances can dramatically reduce machine learning training.
▪ G family instance types include G3/G4/G5 instances.
▪ Cost-effective and versatile GPU instances that enable the deployment
of graphics-intensive programs and machine learning modeling.
▪ Optimized for machine learning workloads that use NVIDIA libraries.
▪ NVIDIA A10G for G5 is often used for graphics applications and 3D
modeling.
EC2 instance - Accelerated Computing (P4, G5, F1)

▪ F1 instances rely on FPGAs for the delivery of custom hardware


accelerations.
▪ A Field-Programmable Gate Array (FPGA) is an Integrated Circuit (IC)
that is customizable in the field for a specific purpose.
▪ A regular CPU is burned at the factory and cannot be changed once it
leaves the factory floor.
▪ An example of this is the Intel Pentium chip. Intel manufactures millions
of these chips, all of them precisely the same.
▪ FPGAs are field-programmable, meaning the end-user can change them
after they leave the factory.
▪ FPGAs can be customized for individual needs and burned by the
customer.
EC2 instance - Memory Optimized (R6, X2, High
Memory)
▪ Memory Optimized instances are used for anything that needs
memory-intensive applications, such as real-time big data analytics,
in-memory databases, enterprise-class applications that require
significant memory resources, or general analytics such as Hadoop
or Spark.
▪ R family instance types include R4/R5/R6 instances.
▪ R6i uses the Intel chip, and R6g uses the Graviton 2 chip.
▪ Best suited for memory-intensive applications.
▪ R6 instance types use the AWS Nitro System, which reduces costs
compared to its competitors.
EC2 instance - Memory Optimized (R6, X2, High
Memory)
▪ X1 and X2 instances deliver a high ratio of memory to compute.
▪ X2 instances across processors such as Graviton 2 (X2gd) and Intel Xeon
(X2idn/X2).
▪ X2 instances offer up to 50% better price-performance than X1
instances.
▪ X1e type delivers the highest memory-to-compute ratio of all EC2
instance types.
▪ High Memory instances deliver the most significant amount of
available RAM, providing up to 24 TB of memory per server.
▪ High Memory instances are best suited for production environments of
petabyte-scale databases.
EC2 instance - Storage Optimized (H1, D3, I4)

▪ Storage Optimized instances are ideal for tasks requiring local access
to large amounts of storage, extreme storage performance, or both.
▪ Instances include both a large-capacity HDD and an extremely low-
latency local NVMe.
▪ EC2 instances have access to Amazon Elastic Block Store for block-
level storage at any scale.
▪ H1 and D3 instance types form part of the dense storage family of
servers that can supply sequential reads and writes with petabyte-
scale datasets.
▪ These instances provide storage on HDDs.
▪ H1 instances can supply up to 16 TB, and D3 can supply up to 48 TB.
▪ EC2 D2 instances, D3 instances can significantly faster read and write
disk throughput, with an improvement of up to 45%.
EC2 instance - Storage Optimized (H1, D3, I4)

▪ I4 instances launched across diverse processors such as Graviton 2


(Im4gn/Is4gen).
▪ I4 instances provide SSD storage up to 30 TB while supplying lower
latency than HDD-based storage.
▪ I4 instances deliver markedly improved I/O latency, with up to 60%
lower latency and a reduction of up to 75% in latency variability when
compared to I3 and I3en instances.
Launching an Amazon EC2 instance

▪ Advantages of EC2
▪ Reliability
▪ EC2 is built on 24 Regions and over 76 global Availability Zones and
serves millions of customers ranging from large enterprises to
start-ups. EC2 has an SLA commitment of 99.99% availability for
each Region. Overall, this makes AWS EC2 very reliable.
▪ Security
▪ Client systems that are allowed to connect to EC2 must also meet
strict security standards such as PCI, SOC, and FedRAMP.
▪ Can create entire networks under IPsec to define a logically
isolated section of AWS using a Virtual Private Network (VPN).
▪ https://aws.amazon.com/ec2/nitro/nitro-enclaves/.
1.Select an AMI

▪ Advantages of EC2
▪ Reliability
▪ EC2 is built on 24 Regions and over 76 global Availability Zones and
serves millions of customers ranging from large enterprises to
start-ups. EC2 has an SLA commitment of 99.99% availability for
each Region. Overall, this makes AWS EC2 very reliable.
▪ Security
▪ Client systems that are allowed to connect to EC2 must also meet
strict security standards such as PCI, SOC, and FedRAMP.
▪ Can create entire networks under IPsec to define a logically
isolated section of AWS using a Virtual Private Network (VPN).
▪ https://aws.amazon.com/ec2/nitro/nitro-enclaves/.
Creating a new AMI: Example
2.Select an instance type
EC2 instance type naming and sizes
EC2 instance types: Networking features
3. Specify network settings
4. Attach IAM Role
5. User Data Scrip - optional
6. Specify Storage
Amazon EC2 storage options
Example storage options
7. Add tags
8. Security group settings
9. Identify or create the key pair
Launch an EC2 instances with AWS CLI
Amazon EC2 instance lifecycle
Considering using an Elastic IP address
EC2 instance metadata
EC2 Pricing Model
EC2 Pricing Model

▪ AWS provides multiple options to further optimize your costs.


▪ As servers are a significant part of any IT infrastructure, it is better
to understand all the available cost options to get the most out of
your dollar.
▪ The following are the four different ways to purchase compute in
AWS:
▪ On-Demand
▪ Reserved Instances
▪ Saving plan
▪ Spot Instances
EC2 Pricing Model
EC2 Pricing Model
EC2 Pricing Model

▪ On-Demand:
▪ Pay for compute capacity by the second without any long-term
commitment.
▪ It is best suited for fluctuating workloads, for example, stock trading or
e-commerce website traffic.
▪ It is the default choice when you spin up an instance and is also suitable
for quick experiments.
EC2 Pricing Model

▪ Reserved Instance (RI):


▪ You can commit 1 or 3 years to a specific EC2 instance family and
receive a significant discount of up to 72% off On-Demand prices.
▪ Best for a steady workload that you know will not fluctuate much, for
example, an internal HR portal.
▪ RI is like a coupon: you pay in advance, and it applies automatically
when your spin-up instance belongs to the same EC2 instance family for
which you pay the RI price.
▪ AWS also provides Convertible RIs, where you can exchange one or
more Convertible RIs for another Convertible RI with a different
configuration, including instance family, operating system, and tenancy.
▪ Convertible RI must be of an equal or higher value than the one you’re
exchanging.https://aws.amazon.com/ec2/pricing/reserved-
instances/pricing/.
EC2 Pricing Model

▪ Savings Plan:
▪ This is like an RI, but monetary commitment and compute can be used
across Fargate, EC2, and AWS Lambda. In a savings plan, you don’t have
to make commitments to specific instance configurations but commit to
a spending amount.
▪ Get savings, up to 72% off On-Demand instances, with the flexibility to
apply it across instance families.
▪ AWS has two types of Savings Plans:
▪ EC2 Instance Savings Plans
▪ Compute Savings Plans.
EC2 Pricing Model

▪ Spot Instances:
▪ Same as the pay-as-you-go pricing model of On-Demand, but at up to
90% off.
▪ EC2 can reclaim Spot Instances with a 2-minute warning.
▪ They are best for stateless or fault-tolerant workloads.
Auto Scaling
Auto Scaling

▪ A distinct advantage of deploying applications to the cloud is the


ability to launch and then release servers in response to variable
workloads.
▪ Provisioning servers on demand and then releasing them when they
are no longer needed can provide significant cost savings for
workloads that are not steady state.
▪ Examples include a website for a specific sporting event, an end-of-
month data-input system, a retail shopping site supporting flash
sales, a music artist website during the release of new songs, a
company website announcing successful earnings, or a nightly
processing run to calculate daily activity.
Auto Scaling

▪ Auto Scaling is a service that allows you to scale your Amazon EC2
capacity automatically by scaling out and scaling in according to
criteria that you define.
▪ With Auto Scaling can ensure that the number of running Amazon
EC2 instances increases during demand spikes or peak demand
periods to maintain application performance and decreases
automatically during demand lulls or troughs to minimize costs.
Auto Scaling Plans

▪ Several schemes or plans are available to control how you want auto
scaling to perform
▪ Maintain current instance levels -configure your Auto Scaling group to
maintain a minimum or specified number of running instances at all
times.
▪ To maintain the current instance levels, Auto Scaling performs a periodic
health check on running instances within an Auto Scaling group.
▪ If found an unhealthy instance, it terminates that instance and launches a
new one.
▪ Manual scaling - specify the change in the maximum, minimum, or
desired capacity of your Auto Scaling group.
▪ Auto Scaling manages the process of creating or terminating instances to
maintain the updated capacity.
Auto Scaling Plans

▪ Several schemes or plans are available to control how you want auto
scaling to perform
▪ Scheduled Scaling – customer know exactly when you will need to
increase or decrease the number of instances in your group, simply
because that need arises on a predictable schedule.
▪ Scheduled scaling means that scaling actions are performed automatically
as a function of time and date.
▪ Dynamic Scaling - define parameters that control the Auto Scaling
process in a scaling policy.
▪ For example, you might create a policy that adds more Amazon EC2
instances to the web tier when the network bandwidth, measured by
Amazon CloudWatch, reaches a certain threshold.
Auto Scaling Components

▪ Auto Scaling has several components that need to be configured to


work properly:
▪ A launch configuration
▪ Auto Scaling group
▪ Scaling policy (optional).
Auto Scaling Components

▪ Launch configuration
▪ It uses to create new instance – configuration name, AMI, Amazon EC2
Instance Type, Security Group, and instance key pair.
▪ Only one launch configuration at a time.
▪ CLI command – creating a launch configuration with attributes
▪ Name: myLC
▪ AMI: ami-0535d66c
▪ Instance type: m3.medium
▪ Security groups: sg-f57cde9d
▪ Instance key pair: myKeyPair
▪ >aws autoscaling create-launch-configuration -–launch-configuration-name
myLC --image-id ami-0535d66c --instance-type m3.medium --security-
groups sg-f57cde9d --key-name myKeyPair
Auto Scaling Components

▪ Launch configuration
▪ Security groups for instances launched in EC2-Classic may be referenced
by security group name such as “SSH” or “Web” if that is what they are
named, or you can reference the security group IDs, such as sg-
f57cde9d.
▪ The default limit for launch configurations is 100 per region.
▪ To modify - > aws autoscaling describe-account-limits
Auto Scaling Components

▪ Auto Scaling Group


▪ An Auto Scaling group is a collection of Amazon EC2 instances managed
by the Auto Scaling service.
▪ Each Auto Scaling group contains configuration options that control
when Auto Scaling should launch new instances and terminate
existing instances.
▪ An Auto Scaling group must contain a name and a minimum and
maximum number of instances that can be in the group.
▪ CLI command that follows will create an Auto Scaling group that
references the previous launch configuration
Auto Scaling Components

▪ Auto Scaling Group


▪ Name: myASG
▪ Launch configuration: myLC
▪ Availability Zones: us-east-1a and us-east-1c
▪ Minimum size: 1
▪ Desired capacity: 3
▪ Maximum capacity: 10
▪ Load balancers: myELB
▪ > aws autoscaling create-auto-scaling-group --auto–scaling-group-name
myASG --launch-configuration-name myLC --availability-zones us-
east-1a, us-east-1c –minsize 1 --max-size 10 --desired-capacity 3 --
load-balancer-names myELB
Auto Scaling Components
▪ AWS resources after a load balancer named myELB is created and the launch configuration myLC
Auto Scaling Components

▪ Scaling Policy – (optional)


▪ Several ways to configure a scaling policy:
▪ Increase or decrease by a specific number of instances, such as adding two
instances;
▪ Target a specific number of instances, such as a maximum of five total
Amazon EC2 instances
▪ Adjust based on a percentage.
▪ Scale by steps and increase or decrease the current capacity of the group
based on a set of scaling adjustments that vary based on the size of the
alarm threshold trigger.
Elastic Load Balancing
Elastic Load Balancing

▪ An advantage of having access to a large number of servers in the


cloud, such as Amazon EC2 instances on AWS, is the ability to
provide a more consistent experience for the end user.
▪ One way to ensure consistency is to balance the request load across
more than one server.
▪ A load balancer is a mechanism that automatically distributes traffic
across multiple Amazon EC2 instances.
Elastic Load Balancing

▪ Elastic Load Balancing service


▪ Allows you to distribute traffic across a group of AmazonnEC2
instances in one or more Availability Zones,
▪ Enabling you to achieve high availability in your applications.
▪ Supports routing and load balancing of Hypertext Transfer Protocol
(HTTP), Hypertext Transfer Protocol Secure (HTTPS), Transmission
Control Protocol (TCP), and Secure Sockets Layer (SSL) traffic to Amazon
EC2 instances.
▪ Provides a stable, single Canonical Name record (CNAME) entry point
for Domain Name System (DNS) configuration and supports both
Internet-facing and internal application-facing load balancers.
▪ Supports health checks for Amazon EC2 instances to ensure traffic is
not routed to unhealthy or failing instances.
▪ Can automatically scale based on collected metrics.
Elastic Load Balancing

▪ Advantages of Elastic Load Balancing


▪ Highly available within a region itself as a service.
▪ Achieve high availability for your applications by distributing traffic
across healthy instances in multiple Availability Zones.
▪ Integrates with the Auto Scaling service to automatically scale the
Amazon EC2 instances behind the load balancer.
▪ It is secure, working with Amazon Virtual Private Cloud (Amazon VPC)
to route traffic internally between application tiers, allowing you to
expose only Internet-facing public IP addresses.
▪ Supports integrated certificate management and SSL termination.
Types of Load Balancers

▪ Provides several types of load balancers for handling different kinds


of connections including
▪ Internet-facing Load Balancer
▪ Internal Load Balancer,
▪ Load balancers that support encrypted connections.
▪ HTTPS Load Balancer
▪ Listeners
Types of Load Balancers

▪ Internet-Facing Load Balancers


▪ As the name implies, a load balancer that takes requests from
clients over the Internet and distributes them to Amazon EC2
instances that are registered with the load balancer.
▪ While configuring a load balancer, it receives a public DNS name
that clients can use to send requests to your application.
▪ The DNS servers resolve the DNS name to your load balancer’s
public IP address, which can be visible to client applications.
▪ Elastic Load Balancing scales in and out to meet traffic demand, it is
not recommended to bind an application to an IP address that may
no longer be part of a load balancer’s pool of resources.
Types of Load Balancers

▪ Internal Load Balancers


▪ In a multi-tier application, it is often useful to load balance between the
tiers of the application.
▪ For example, an Internet-facing load balancer might receive and
balance external traffic to the presentation or web tier whose Amazon
EC2 instances then send its requests to a load balancer sitting in front
of the application tier.
▪ You can use internal load balancers to route traffic to your Amazon
EC2 instances in VPCs with private subnets.
Types of Load Balancers

▪ HTTPS Load Balancers


▪ Load balancer can use the SSL/Transport Layer Security (TLS) protocol
for encrypted connections (also known as SSL offload).
▪ It enables traffic encryption between your load balancer and the clients
that initiate HTTPS sessions, and for connections between your load
balancer and your back-end instances.
▪ It provides security policies - predefined SSL negotiation configurations
to negotiate connections between clients and the load balancer.
▪ In order to use SSL, you must install an SSL certificate on the load
balancer that it uses to terminate the connection and then decrypt
requests from clients before sending requests to the back-end
Amazon EC2 instances.
Types of Load Balancers

▪ HTTPS Load Balancers


▪ Elastic Load Balancing does not support Server Name Indication (SNI)
on your load balancer.
▪ This means that if you want to host multiple websites on a fleet of
Amazon EC2 instances behind Elastic Load Balancing with a single SSL
certificate, you will need to add a Subject Alternative Name (SAN) for
each website to the certificate to avoid site users seeing a warning
message when the site is accessed.
Types of Load Balancers

▪ Listeners
▪ Every load balancer must have one or more listeners configured.
▪ A listener is a process that checks for connection requests—for
example, a CNAME configured to the A record name of the load
balancer.
▪ Every listener is configured with a protocol and a port (client to load
balancer) for a front-end connection and a protocol and a port for
the back-end (load balancer to Amazon EC2 instance) connection.
▪ Elastic Load Balancing supports the following protocols:
▪ HTTP
▪ HTTPS
▪ TCP
▪ SSL
Types of Load Balancers

▪ Listeners
▪ Elastic Load Balancing supports protocols operating at two different
Open System Interconnection (OSI) layers.
▪ In the OSI model, Layer 4 is the transport layer that describes the TCP
connection between the client and your back-end instance through the
load balancer.
▪ Layer 4 is the lowest level that is configurable for your load balancer.
▪ Layer 7 is the application layer that describes the use of HTTP and
HTTPS connections from clients to the load balancer and from the load
balancer to your back-end instance.
▪ The SSL protocol establishes a secure connection between a client and
the back-end server and ensures that all the data passed between your
client and your server is private.
Configuring Elastic Load Balancers

▪ Can be Configured on many aspects:


▪ Idle connection timeout,
▪ Cross-zone load balancing,
▪ Connection draining,
▪ Proxy protocol,
▪ Sticky sessions, and
▪ Health checks.
▪ Configuration settings can be modified using either the AWS
Management Console or a Command Line Interface (CLI).
Configuring Elastic Load Balancers

▪ Idle Connection Timeout


▪ For each request that a client makes through a load balancer, the load
balancer maintains two connections - the client and the back-end
instance.
▪ For each connection, the load balancer manages an idle timeout that is
triggered when no data is sent over the connection for a specified time
period.
▪ Idle timeout period has elapsed, if no data has been sent or received,
the load balancer closes the connection.
▪ By default, Idle timeout to 60 seconds for both connections.
Configuring Elastic Load Balancers

▪ Idle Connection Timeout


▪ You can change the idle timeout setting for the connections to ensure
that lengthy operations, such as file uploads, have time to complete.
▪ If you use HTTP and HTTPS listeners, enable the keep-alive option for
your Amazon EC2 instances.
▪ You can enable keep-alive in your web server settings or in the kernel
settings for your Amazon EC2 instances.
▪ Keep-alive, when enabled, allows the load balancer to reuse
connections to your back-end instance, which reduces CPU utilization.
Configuring Elastic Load Balancers

▪ Cross-Zone Load Balancing


▪ To ensure that request traffic is routed evenly across all back-end
instances for your load balancer, regardless of the Availability Zone in
which they are located, you should enable cross-zone load balancing
on your load balancer.
▪ Cross-zone load balancing reduces the need to maintain equivalent
numbers of back-end instances in each Availability Zone and improves
your application’s ability to handle the loss of one or more back-end
instances.
▪ Recommended - maintain approximately equivalent numbers of
instances in each Availability Zone for higher fault tolerance.
Configuring Elastic Load Balancers

▪ Connection Draining
▪ To ensure that the load balancer stops sending requests to instances
that are deregistering or unhealthy, while keeping the existing
connections open.
▪ This enables the load balancer to complete in-flight requests made to
these instances.
▪ In connection draining, you can specify a maximum time for the load
balancer to keep connections alive before reporting the instance as
deregistered.
▪ The maximum timeout value can be set between 1 and 3,600 seconds
(the default is 300 seconds).
▪ The maximum time limit is reached, the load balancer forcibly closes
connections to the deregistering instance.
Configuring Elastic Load Balancers

▪ Proxy Protocol
▪ Using CP or SSL for both front-end and back-end connections, your load
balancer forwards requests to the back-end instances without
modifying the request headers.
▪ Enable Proxy Protocol, a human-readable header is added to the
request header with connection information such as the source IP
address, destination IP address, and port numbers, and sent to the
back-end instance as part of the request.
▪ If Proxy Protocol is enabled on both the proxy server and the load
balancer, the load balancer adds another header to the request, which
already has a header from the proxy server.
Configuring Elastic Load Balancers

▪ Sticky Sessions
▪ Sticky session feature (also known as session affinity), which enables
the load balancer to bind a user’s session to a specific instance.
▪ This ensures that all requests from the user during the session are sent
to the same instance.
▪ It determines how long your load balancer should consistently route
the user’s request to the same instance.
▪ If your application has its own session cookie, you can configure Elastic
Load Balancing uses the duration specified in application’s session
cookie.
▪ If your application does not have its own session cookie, you can
configure Elastic Load Balancing to create a session cookie by
specifying your own stickiness duration.
▪ Elastic Load Balancing creates a cookie named AWSELB.
Configuring Elastic Load Balancers

▪ Health Checks
▪ Elastic Load Balancing supports health checks to test the status of the
Amazon EC2 instances behind an Elastic Load Balancing load balancer.
▪ The status of the instances that are healthy at the time of the health
check is InService.
▪ The status of any instances that are unhealthy at the time of the health
check is OutOfService.
▪ The load balancer performs health checks on all registered instances to
determine whether the instance is in a healthy state or an unhealthy
state.
▪ You can set a threshold for the number of consecutive health check
failures before an instance is marked as unhealthy.
Module 2
BCSE355L – AWS Solution Architect

You might also like