CDN with AWS and Azure (Simplified)
Tags: aws, cdn, cloudfront, azure
Published: 2023-01-18 03:30:24

A Content Delivery Network (CDN) is a **system of distributed servers** that are used to deliver web content to users. The idea behind a CDN is **to serve content to users from a server that is geographically closest to them**, in order to **reduce the latency** and improve the **speed of delivery**.

For example, imagine a website called "example.com" that is hosted on a server located in New York. If a user in Australia tries to access the website, the data has to travel a long distance and may take a while to load. However, if "example.com" is using a CDN, the **website's content is replicated and stored on multiple servers located in different regions around the world**. So, when the user in Australia accesses "example.com", the request is directed to the nearest server (e.g. in Singapore), which serves the content to the user much faster than if the request had to travel all the way to the original server in New York.

In this way, **CDN helps to improve the speed, availability, and scalability** of a website by distributing the traffic across multiple servers.

##AWS CDN - CloudFront

Amazon Web Services (AWS) offers a Content Delivery Network (CDN) service called Amazon CloudFront. CloudFront is a global content delivery network that securely delivers data, videos, applications, and APIs to customers globally with low latency, high transfer speeds, and secure connections.

With CloudFront, users can create a distribution, which is an instance of the CloudFront service. A distribution is associated with a specific origin, which is the location of the original, un-cached version of the files that the distribution will serve. The origin could be an Amazon S3 bucket, an EC2 instance, an Elastic Load Balancer, or even an external server.

Once a distribution is created, CloudFront automatically provisions and manages a global network of edge locations. When a user requests content that is associated with a distribution, CloudFront routes the request to the edge location that provides the lowest latency, so the content is delivered with the best possible performance.

In addition to caching and delivering content, CloudFront also provides security features such as SSL/TLS encryption and the ability to set up custom SSL certificates, as well as the ability to create custom error pages and restrict access to the content using authentication and authorization.

One of the benefits of using AWS CloudFront is that it integrates seamlessly with other AWS services, such as S3, Elastic Load Balancing, and Route 53, making it easy to use as part of a larger, more complex architecture.

How it works -

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g8plzbnh4ihhjfkogyl4.png)



## Azure CDN

Azure Content Delivery Network (CDN) is a service provided by Microsoft Azure that allows for the delivery of content from a global network of edge locations to users with low latency and high transfer speeds.

Azure CDN allows users to create a CDN endpoint, which is a point of presence (POP) on the Azure CDN network. The endpoint is associated with a specific origin, which is the location of the original, un-cached version of the files that the endpoint will serve. The origin could be an Azure storage account, an Azure Cloud Service, an Azure Virtual Machine, or even an external server.

Once an endpoint is created, Azure CDN automatically provisions and manages a global network of edge locations. When a user requests content that is associated with an endpoint, Azure CDN routes the request to the edge location that provides the lowest latency, so the content is delivered with the best possible performance.

Azure CDN also provides security features such as SSL/TLS encryption, the ability to set up custom SSL certificates and restrict access to the content using authentication and authorization. Azure CDN also has integration with Azure services like Azure storage, Azure App Service, Azure Virtual Machine and Azure Cloud Service.

Additionally, Azure CDN also provides real-time analytics and monitoring capabilities, such as real-time metrics, logs, and alerts, which can be used to monitor the performance and usage of the CDN endpoints.

How it works - 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9pa38exu3k5zj4mwwf4k.png)