Amazon CloudFront is a fast content delivery network (CDN) service.Before we discussion about CloudFront we need to understand about edge location and latency.
Edge Locations: Edge locations are network of data centres that deliver content to the end users.It is basically nearest point to user who is using the service.
Latency: It is the delay or time taken for data to deliver from source point to destination.
Amazon CloudFront is a fast CDN (content delivery network) service that securely and speedily delivers data, applications, videos and APIs to customers across the globe with low latency and high transfer speeds.
It speeds up webpage loading by caching all static content (e.g images,JavaScript, style sheets, videos etc) to viewers across the globe with minimal cost.It is not possible to have servers at all edge locations so CloudFront is setup instead to speed up the content delivery at that location.
1. If content is already at the edge location then CloudFront delivers it immediately.
2. If content is not at the edge location, CloudFront retrieves the data from an origin that we’ve defined as source location like Amazon S3 bucket or HTTP server.
How does Amazon CloudFront works: A) End users accesses a website on browser and try to view the page or try to download a file form the website. B) CloudFront will route the request to nearest edge location to server above request. C) CloudFront will check if that page or file is available at that Edge location or not.If its there then it delivers it to user. D) If it does not find that page or file at the edge location, then CloudFront route the request to respective web server. E) Web server responds back with that response. F) CloudFront delivers that page or file to user and also adds it to that edge location for saving time while processing future requests. AWS CloudFront Use cases: Static content: Static content like images,JavaScript,HTML, CSS will be cached to the edge location and gets delivered to the end users with out any delay. This static content will be cached at the edge locations instead of fetching it directly from the origin.This way it increases speed while loading data on websites. Dynamic Content:Dynamic Content is a personalised web page for each user, As CloudFront uses S3 bucket for delivering static content, we can also configure EC2 instance for delivering dynamic content as well. Streaming live Media: Amazon cloudfront can stream audio and video to users by integrating it with S3 buckets and EC2 instances. Benefits of using cloud front: Encryption:CloudFront improves security with traffic encryption and uses AWS Shield Standard and protect distributed denial of service (DDoS) attacks at no additional cost. Scalable:It also scales up to deliver software,games etc heavy applications which requires high transfer speed. Dynamic Transfer:CloudFront not only speeds up the static content but also equally good for dynamic transfer of data as well. Cost effective:It is less expensive since it only charges for the data transfer. Related articles: