Amazon CloudFront is a Content Delivery Network (CDN) that allows you to store (cache) your content at “edge locations” located around the world.

This allows customers to access content more quickly and provides security against DDoS attacks.

CloudFront can be used for data, videos, applications, and APIs.

CloudFront benefits:

Origins and Distributions:

  • An origin is the origin of the files that the CDN will distribute.
  • Origins can be either an S3 bucket, an EC2 instance, an Elastic Load Balancer, or Route 53 – can also be external (non-AWS).
  • To distribute content with CloudFront you need to create a distribution.
  • There are two types of distribution: Web Distribution and RTMP Distribution.

CloudFront uses Edge Locations and Regional Edge Caches:

  • An edge location is the location where content is cached (separate to AWS regions/AZs).
  • Requests are automatically routed to the nearest edge location.
  • Regional Edge Caches are located between origin web servers and global edge locations and have a larger cache.
  • Regional Edge caches aim to get content closer to users.

The diagram below shows where Regional Edge Caches and Edge Locations are placed in relation to end users:

Pricing

CloudFront pricing is determined by:

  • Traffic distribution – data transfer and request pricing, varies across regions, and is based on the edge location from which the content is served.
  • Requests – the number and type of requests (HTTP or HTTPS) and the geographic region in which they are made.
  • Data transfer out – quantity of data transferred out of CloudFront edge locations.
  • There are additional chargeable items such as invalidation requests, field-level encryption requests, and custom SSL certificates.