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.
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.
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.
- 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)
- Open S3 bucket and Upload your content
- Create a CloudFront distribution:
- Go to CloudFront Service from AWS console, Click on Create Distribution.
- Click on the Get Started button
- Configure Distribution Settings:
- Configure Origin Settings and Origin Access Identity
- Configure Default Cache behaviors and TTLs
- Configure distribution settings, http versions, and logs
- Wait for some time around 5-15 min to complete It
- Test Your CloudFront Distribution:
- Copy the CloudFront domain and go to run on the browser. It’s Done!