Skip to main content
Join the Agentforce Hackathon on Nov. 18-19 to compete for a $20,000 Grand Prize. Sign up now. Terms apply.

Learn About the Content Delivery Network

Learning Objectives

After completing this unit, you’ll be able to:

  • Describe what a content delivery network (CDN) is.
  • Identify and explain the benefits of Amazon CloudFront.
Note

Note

This module was produced in collaboration with Amazon Web Services, which owns, supports, and maintains the Amazon Web Services products, services, and features described here. Use of Amazon Web Services products, services, and features is governed by privacy policies and service agreements maintained by Amazon Web Services.

What if you were a software developer for a video streaming service and wanted to improve streaming quality for your customers? How would you deliver hours of content while dealing with expected traffic spikes for the more popular videos?

This is where a content delivery network (CDN) comes in. A CDN is a globally distributed system of caching servers. It caches copies of frequently requested content. The CDN delivers a local copy from a cache edge or point of presence (PoP) for fastest delivery.

Recall edge cache and point of presence from AWS Cloud Basics. We dive deeper into these services in this module.

Say Hello to Amazon CloudFront

Global map showing edge locations in North America, Europe, Asia, Australia, South America, Africa, China, and the Middle East, and regional edge caches in heavily populated areas

Amazon CloudFront is a fast CDN service. It securely delivers data, videos, and applications. It makes application programming interfaces (APIs) accessible to customers around the globe, with low-latency (or time delay) and high-transfer speeds, all within a developer-friendly environment.

Amazon CloudFront is ideal for media and entertainment, gaming, social media, and many more use cases.

Amazon CloudFront uses a network of edge locations and regional edge caches to ensure lower latency for end users. These are smaller collections of servers with wider distribution than the Availability Zones.

Amazon CloudFront ensures that end-user requests are served by the closest edge location. As a result, viewer requests and the system’s response travel shorter distances, improving performance for your customers.

As objects become less popular, individual edge locations might remove those objects to make room for more popular content. For the less popular content, CloudFront has regional edge caches. Regional edge caches are CloudFront locations that are deployed globally and are close to your viewers. They are located between your origin server and the global edge locations that serve content directly to viewers. A regional edge cache has a larger cache than an individual edge location, so objects remain in the regional edge cache longer.

Amazon CloudFront only queries Availability Zones, your origin servers, for content that isn’t cached.

Discover How Amazon CloudFront Works

Amazon CloudFront icon depicting a globe with a network of interconnected circles against a purple background

After you configure Amazon CloudFront to deliver your content, here’s what happens when users request your objects.

  1. A user accesses your website or application and requests one or more objects, such as an image and HTML files.
  2. DNS routes the request to the CloudFront edge location that can best serve the request—typically the nearest CloudFront edge location in terms of latency.
  3. In the edge location, Amazon CloudFront checks its cache for the requested files. If the files are in the cache, CloudFront returns them to the user. If the files are not in the cache:
    1. Amazon CloudFront checks the regional edge location for the requested files and returns them to the user if they are available.
    2. If the files are neither at the edge location nor the regional cache location, Amazon CloudFront forwards the request for the files to your origin server(s) for the corresponding file type—for example, to your Amazon S3 bucket for image files and to your HTTP server for the HTML files.
    3. The origin servers send the files back to the CloudFront edge location.
    4. As soon as the first byte arrives from the origin, Amazon CloudFront begins to forward the files to the user. CloudFront also adds the files to the cache in the edge location and the regional edge cache for the next time someone requests those files.

World map with an S3 bucket in North America delivering content through an edge location cache in Europe to a user accessing an example website from a nearby location

Control Cache Duration with Amazon CloudFront

You can control how long your files stay in an Amazon CloudFront cache before CloudFront forwards another request to your origin server. Here are some things to consider when you configure the duration in cache.

  • Reducing the duration allows you to serve dynamic content.
  • Increasing the duration means that your users get better performance because your files are more likely to be served directly from the edge cache. A longer duration also reduces the load on your origin.
  • By default, each file automatically expires after 24 hours, but you can change the default behavior by adjusting the time to live (TTL) settings for CloudFront.

Amazon CloudFront works seamlessly with other AWS services, including:

  • AWS Shield for distributed denial of service (DDoS) mitigation
  • Amazon Simple Storage Service (Amazon S3) or Amazon Elastic Compute Cloud (Amazon EC2) as origins for your applications
  • Lambda@Edge to run custom code and customize the user experience

Other features include:

  • A global network of edge locations and regional edge caches
  • Network optimizations for better performance
  • Protection against network and application layer attacks
  • Full-featured API operations and DevOps tools
  • Flexible pay-as-you-go publicly available pricing and committed-traffic private pricing

The next unit explores the benefits of Amazon EC2 Auto Scaling.

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback