# CDN

A content delivery network or content distribution network (CDN) is a system of distributed servers that deliver webpages and other web contents to user based on geographic locations of the user, the origin of the webpage and content delivery server The goal of a CDN is to serve content to end-users with high availability and high performance.

#### Amazon CloudFront

Cloudfront is amazon cdn.

* Amazon CloudFront is a global content delivery network (CDN) service that accelerates delivery of your websites, APIs, video content or other web assets through CDN caching.
* It integrates with other Amazon Web Services products such as S3, ec2, ELB, Route 53 to give developers and businesses an easy way to accelerate content to end users with no minimum usage commitments.
* CloudFront delivers your content through a worldwide network of data centers called edge locations.
*   When a user requests content that you're serving with CloudFront, the user is routed to the edge location that provides the lowest latency, so that content is delivered with the best possible performance. If the content is already in the edge location with the lowest latency, CloudFront delivers it

    immediately. If the content is not in that edge location, CloudFront retrieves it from an Amazon S3 bucket or an HTTP server.

#### CloudFront distributions

1. Web distribution – Uses the protocol HTTP or HTTPS to distribute media content
2. RTMP distribution – An RTMP (Real-Time Messaging Protocol) distribution allows an end user to begin playing a media file before the file has finisheddownloading from a CloudFront edge location.

#### Terms



1. Origin Domain Name - The DNS domain name ofthe Amazon S3 bucket or HTTP server from which you want Cloud Front to get objects for this origin
2. Origin Path - If you want Cloud Front to request your content from a directory in your Amazon S3 bucket or your custom origin, enter the directory path, beginning with a /. CloudFront appends the directory path to the value of Origin Domain Name.
3. Origin ID - A string that uniquely distinguishes this origin from other origins in this distribution.
4.  Restrict Bucket Access (Amazon S3 Only) -Choose Yes you want to require users to access objects in an Amazon S3 bucket by using only CloudFront URLs, not by using

    &#x20;Amazon S3 URLs. Then specify the applicable values.Choose No if you want users to be able to access objects  using either CloudFront URLs or Amazon S3 URLs.
5. Viewer protocol policy - Choose the protocol policy that you want viewers to use to access your content in, CloudFront edge locations.
6. &#x20;6\. Allowed http methods - Specify the HTTP methods that you want CloudFront to process and forward to your origin:

> (note: GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE: You can use CloudFront to get, add, update, and delete objects, and to get object headers. In addition, you can perform other POST operations such as submitting data from a web form)

7.Cached HTTP method - Specify whether you want Cloud Front to cache the response from your origin when a viewer submits an OPTIONS request. Cloud Front always caches the response to GET and HEAD requests.



1. Forward header - Specify whether you want CloudFront to forward request headers to your origin server and to cache objects based on header values.
2. Object caching – Specify how long the objects stay in the CloudFront cache.
3.  Minimum TTL - Specify the minimum amount of time, in seconds, that you want objects to stay in CloudFront caches. The default value for Minimum TTL is

    0 seconds.
4. Forward Cookies - Specify whether you want CloudFront to forward cookies to your origin server.
5. Query String Forwarding and Caching - CloudFront can cache different versions of your content based on the values of query string parameters.
6. Smooth Streaming - Choose Yes if you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. Otherwise, choose No.
7. Restrict Viewer Access - If you want requests for objects that match the PathPattern for this cache behavior to use public URLs, choose No Else Yes. 15. SSL Certificate – Specifies the option to access your domain by using defaults cloudfront or domain or custom cloudfront domain.
