Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Working with AWS Elemental MediaPackage and CDNs

Focus mode
Working with AWS Elemental MediaPackage and CDNs - AWS Elemental MediaPackage v2

You can use a content delivery network (CDN) such as Amazon CloudFront to serve the content that you store in AWS Elemental MediaPackage. A CDN is a globally distributed set of servers that caches content such as videos. When a user requests your content, the CDN routes the request to the edge location that provides the lowest latency. If your content is already cached in that edge location, the CDN delivers it immediately. If your content is not currently in that edge location, the CDN retrieves it from your origin (in this case, the MediaPackage endpoint) and distributes it to the user. The following illustration shows this process.

This illustration shows how content that's stored in MediaPackage is distributed using a CDN.

CDN configuration recommendations

To configure your CDN distributions for delivering Apple HLS and low-latency HLS (LL-HLS) streams with MediaPackage, we suggest using the following approach. Ensure that all your usual default parameters in the CDN distribution configuration are compatible with the delivery of HLS and LL-HLS streams with MediaPackage.

Honor MediaPackage 'cache-control: max-age' values

MediaPackage defines time-to-live (TTL) values for objects either statically or dynamically, depending on the object type. The specific TTLs are listed below, and it's strongly recommended that you honor these values and avoid overriding them at the CDN configuration level.

  • Multivariant playlist (for both regular HLS and LL-HLS) - half the duration of the media segments

  • Media playlists (regular HLS) - half the duration of the media segments

  • Media playlists (LL-HLS) - 1 second

  • TS media segments and init segments - 1209600 seconds (14 days)

  • CMAF media segments and initialization segments - 1209600 seconds (14 days)

Include specific Query Strings in your CDN cache key

Some query strings are used to customize the manifests contents (aws.manifestfilter), to define specific startover content window (start and end), to apply time delay on the manifest contents (time_delay), and to support LL-HLS playback requests logic (_HLS_msn and _HLS_part). It's therefore recommended to include these six query strings in the CDN cache key. MediaPackage will ignore all other query strings, so don't include them in the CDN forward requests.

Response timeout

LL-HLS uses the Blocking Requests mechanism for both playlists and media parts, which is signaled through the EXT-X-PRELOAD-HINT tag. This mechanism puts the origin response on hold until the object is fully available. Consequently, the CDN should also wait for the origin response, and therefore, the response timeout value in your CDN distribution should be at least three times your parts duration.

Forwarded HTTP headers

You may consider including the Origin header in your CDN forward requests to MediaPackage as the only potentially necessary HTTP request header. In doing so, MediaPackage will respond with an access-control-allow-origin header, using the value passed as the Origin header value. If the Origin header is not included in the forward requests, MediaPackage will respond with an access-control-allow-origin: * header. Choose the approach that best fits your CORS requirements.

Forwarded cookies

MediaPackage doesn't consider any cookies that may be sent together with forward requests. Therefore, it's advisable to exclude cookies from CDN forward requests.

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.