Cloudfront is a low-latency content delivery network (CDN) service provided by AWS. Like any other CDN services, Cloudfront will distribute and deliver files all over the world using different AWS datacenters or edge locations.
Cloudfront Essentials, Tips, and References
In this article, we have explained the CloudFront essentials, tips, and references that would help you in preparing for the AWS certifications.
To understand CloudFront, you need to know about the following terminologies.
- Edge Location: An edge location is an amazon facility where your content will be cached. CloudFront edge locations are present all major the world. Contains over 50 edge locations spread across the world.
- Origin: An origin is a place where your original files that have to be served are present. An origin could be a web server (outside AWS), ec2 instance, s3, ELB, Route another other storage which is accessible through the internet.
- Distribution: This is the name of the CDN which consists of several edge locations for your content distribution. Basically, this would be a unique URL for your content distribution.
- Web Distribution: Used typically for websites.
- RTMP: Typically for streaming media which supports Adobe flash media server RTMP protocol.
Following are the things you should know about object caching.
- The object cache time totally depends on the TTL you give while creating a distribution.
- You can also delete the cache, for which you will be charged.
Note: Let’s say, your video is cached and you uploaded a new version of it. Until the TTL period, CloudFront will service the old version. Once the TTL expires, CloudFront will request the new version for caching.
- You can create multiple origins per distribution.
- Each origin id should be unique to distinguish between same origins in a distribution.
- CloudFront Signed URL’s or cookies are used to restrict resource access to specific users.
- You can use AWS WAF ACL’s to restrict access to the CloudFront content.
- You can log CloudFront access logs to s3.
- You can use the geo restriction feature to restrict or allow your content access.
Cloudfront Use Cases
Following are the few use cases for which you could leverage CloudFront for content distribution.
- Serving Website Content: Top service static and dynamic content of a website.
- You could either use a single origin for both static or dynamic content.
- Or, create two different origins for static and dynamic content. This way you get granular management of your content delivery.
- CloudFront caches your content at each edge location.
- It proxies the request for all your interactive or dynamic content managed through CloudFront. Once the content is delivered , the user request will go through the edge location server to your origin server. This improves speed and losers latency in accessing the content.
- You can also make use of CloudFront to upload content to your origin server. This will make use of AWS network for uploading by proxying the request at edge location.
- It supports file upload up to 20 GB size.
- You can also use CloudFront to deliver your API’s.
- Serving Downloadable Softwares: You can deliver downloadables and software updates using CloudFront. If your user base is located worldwide, CloudFront would reduce the latency.
- Serving Streaming Data: You can also service streaming data through Cloudfront. It could be pre-recorded, on-demand progressive download or a live streaming event.
To have an overview of how CloudFront fits in with application, you can refer this -> Cloudfront reference architecture
Take a look at the following image to know howCloudFrontt works.