Support Documents
×
No data found.

Use Amazon CloudFront for dynamic Websites

Lab Details

  1. 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.

  2. Duration: 90 minutes

  3. AWS Region: US East (N. Virginia)

Introduction

What is CloudFront?

  • 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.

What is Elastic Load Balancing?

  • 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 :

    1. Application Load Balancers

    2. Network Load Balancers

    3. 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.

What is EC2?

  • 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.

Task Details

  1. Launching Lab Environment.

  2. Launch two EC2 Instances using Bash script.

  3. Create an application Load Balancer.

  4. Create the CloudFront Distribution.

  5. Test the distribution.

  6. Validation of the lab.

Architecture Diagram



Join Whizlabs_Hands-On to Read the Rest of this Lab..and More!

Step 1 : Login to My-Account
Step 2 : Click on "Access Now" to view the course you have purchased
Step 3 : You will be taken to our Learn Management Solution (LMS) to access your Labs,Quiz and Video courses