Content delivery network with Amazon CloudFront

What is Content delivery network?

A content delivery network (CDN) is a globally distributed set of servers that helps to provide fast delivery of Internet content by minimizing the distance between the server and the end user.

A CDN caches static and dynamic web content such as .html, .css, .js, image, and video files in multiple geographical locations, also known as points of presence (PoPs).

For example, if a website (www.cloudiofy.com) is hosted in  US East (N. Virginia) region, then all of the website visitor’s requests, will receive a response from N. Virginia server without CDN. After enabling CDN, website content is automatically stored from the hosted(origin) server to the POPs and delivered to the visitor by cache servers. It helps to reduce the loading time of website.

content delivery network

What is Amazon CloudFront

Amazon CloudFront is a web service to provide a fast content delivery network (CDN) solution.

Features of CloudFront

  • Fast and global: Amazon CloudFront is broadly scaled and globally distributed, It has around 216 Points of Presence (205 Edge Locations and 11 Regional Edge Caches) in 84 cities across 42 countries which results to make It fast.
  • Security: Amazon CloudFront is a highly secured service that provides security like
    • Network and Application Layer Attacks: Amazon services such as CloudFront, AWS Shield, AWS Web Application Firewall (WAF), and Amazon Route 53 work seamlessly together to create a flexible, layered security boundary against multiple types of attacks including network and application layer DDoS attacks.
    • SSL/TLS Encryptions and HTTPS: CloudFront allows you to deliver your web content, APIs, or applications using SSL/TLS.
    • Access Control: CloudFront allows to apply access control security on your content such as authentication, geo-restriction, and Origin Access Identity to deliver S3 bucket content from CloudFront only.
  • Programmable and DevOps Friendly: CloudFront provides fully featured APIs to create, configure and customize your CloudFront distribution, as per your application requirements.
  • Cost Effective: Amazon CloudFront allows free data transfer between AWS cloud services and Amazon CloudFront, and there is no minimum fee to use CloudFront service. It is based on Pay-as-you-go model.amazon cloudfront

Example to setup AWS CloudFront using an S3 bucket

Let’s see an example, of setup CloudFront distribution step by step, using an Amazon S3 bucket.

  1. Create an origin server such as an Amazon S3 bucket or HTTP web server with EC2. For example, Start with an Amazon S3 bucket as an origin server:
    • Sign in to AWS management console, Go to S3 service, Create an S3 bucket (e.g. cloudiofy-cloudfront-demo)cf create bucket
    • Open S3 bucket and Upload your contentcf upload s3 content
  2. Create a CloudFront distribution:
    • Go to CloudFront Service from AWS console, Click on Create Distribution.cf create distribution
    • Click on the Get Started buttoncf getstart distribution
    • Configure Distribution Settings:
      • Configure Origin Settings and Origin Access Identitycf configure origion settings
      • Configure Default Cache behaviors and TTLscf configure default cachecf ttl settings
      • Configure distribution settings, http versions, and logscf distribution settingscf distribution http settings
      • Wait for some time around 5-15 min to complete Itcf created distribution successfully
  3. Test Your CloudFront Distribution:
    • Copy the CloudFront domain and go to run on the browser.cf created distribution test It’s Done!

Content delivery network with Amazon CloudFront
Scroll to top