This lab walks you through the creation of an Amazon CloudFront distribution. It will distribute a publicly accessible Dynamic PHP page. You will create an Application Load Balancer which distributes incoming traffic across 2 Amazon EC2 instances which are hosted with PHP webpage.
Duration: 90 minutes
AWS Region: US East (N. Virginia)us-east-1
Amazon CloudFront is a content delivery network (CDN) offered by AWS.
CDN provides globally-distributed network of proxy servers which cache content, i.e., web videos or other bulky media, more locally to consumers, thus improving access speed for downloading the content.
CloudFront service works on a pay-as-you-go basis.
CloudFront works with origin servers like S3, EC2 where the content is stored and is pushed out to multiple CloudFront servers as content is requested.
When CloudFront is enabled, the content is stored on the main S3 server.
Copies of this content are created on a network of servers around the world called CDN.
Each server within this network is called an Edge server, which will only have a copy of your content.
When a request is made to the content, the user is provided from the nearest edge server.
CloudFront has features similar to dynamic site acceleration, a method used to improve online content delivery.
CloudFront accelerates the delivery of dynamic content by moving it closer to the user to minimize internet hops involved in retrieving the content.
CloudFront's Web distribution supports "Progressive" download i.e., data from S3 is cached and then streamed without disruptions.
Due to that, the user cannot move front or back in the video i.e., the video is processed bit by bit.
CloudFront's Web distribution support "Streaming" allows users to directly watch without any download.
Due to that, the user can move front or back in the video, the latency is based on the size of the file and the customer Internet bandwidth.
This service is beneficial for those developing a website that distributes a lot of content and needs to scale-up.
It helps reduce costs and improve the performance of a website by providing high data transfer speeds and low latency.
ELB is a service that automatically distributes incoming application traffic and scales resources to meet traffic demands.
ELB helps in adjusting capacity according to incoming application and network traffic.
ELB can be enabled within a single availability zone or across multiple availability zones to maintain consistent application performance.
ELB offers features like :
Detection of unhealthy EC2 instances.
Spreading EC2 instances across healthy channels only.
Centralized management of SSL certificates.
Optional public key authentication.
Support for both IPv4 and IPv6.
ELB accepts incoming traffic from clients and routes requests to its registered targets.
When an unhealthy target or instance is detected, ELB stops routing traffic to it and resumes only when the instance is healthy again.
ELB monitors the health of its registered targets and ensures that the traffic is routed only to healthy instances.
ELB's are configured to accept incoming traffic by specifying one or more listeners. A listener is a process that checks for connection requests.
Listeners are configured with a protocol and port number from client to the ELB, and vise-versa i.e., back from ELB to target.
ELB supports 3 types of load balancers
Application Load Balancers
Network Load Balancers
Classic Load Balancers
Each load balancer is configured differently.
For Application and Network Load Balancers, you register targets in target groups and route traffic to target groups.
For Classic Load Balancers, you register instances with the load balancer.
AWS recommends users to work with Application Load Balancer to use multiple Availability Zones because if one availability zone fails, the load balancer can continue to route traffic to the next available one.
We can have our load balancer be either internal or internet-facing.
The nodes of an internet-facing load balancer have Public IP addresses, and the DNS name is publicly resolvable to the Public IP addresses of the nodes.
Due to the point above, internet-facing load balancers can route requests from clients over the Internet.
The nodes of an internal load balancer have only Private IP addresses, and the DNS name is publicly resolvable to the Private IP addresses of the nodes.
Due to the point above, internal load balancers can only route requests from clients with access to the VPC for the load balancer.
Both internet-facing and internal load balancers route requests to your targets using Private IP addresses.
Your targets do not need Public IP addresses to receive requests from an internal or an internet-facing load balancer.
AWS defines it as Elastic Compute Cloud.
It’s a virtual environment where “you rent” to have your environment created, without purchasing.
Amazon refers to these virtual machines as Instances.
Preconfigured templates can be used to launch instances. These templates are referred to as images. Amazon provides these images in the form of AMIs (Amazon Machine Images).
Allows you to install custom applications and services.
Scaling of infrastructure i.e., up or down is easy based on the demand you face.
AWS provides multiple configurations of CPU, memory, storage etc., through which you can pick the flavor that's required for your environment.
No limitation on storage. You can pick the storage based on the type of the instance that you are working on.
Temporary storage volumes are provided, which are called Instance Store Volumes. Data stored in this gets deleted once the instance is terminated.
Persistent storage volumes are available and are referred to as EBS (Elastic Block Store) volumes.
These instances can be placed at multiple locations which are referred to as Regions and Availability Zones (AZ).
You can have your Instances distributed across multiple AZs i.e., within a single Region, so that if an instance fails, AWS automatically remaps the address to another AZ.
Instances deployed in one AZ can be migrated to another AZ.
To manage instances, images, and other EC2 resources, you can optionally assign your own metadata to each resource in the form of tags.
A Tag is a label that you assign to an AWS resource. It contains a key and an optional value, both of which are defined by you.
Each AWS account comes with a set of default limits on the resources on a per-Region basis.
For any increase in the limit you need to contact AWS.
To work with the created instances, we use Key Pairs.
Launching Lab Environment.
Launch two EC2 Instances using Bash script.
Create an application Load Balancer.
Create the CloudFront Distribution.
Test the distribution.
Validation of the lab
Deleting AWS resources