

# Build MediaTailor linear channels with channel assembly and CDN
<a name="ca-cdn-wflw"></a>

This section provides comprehensive guidance for integrating AWS Elemental MediaTailor channel assembly with a content delivery network (CDN). Follow these steps to set up, configure, and optimize your channel assembly CDN integration.

You can also combine channel assembly with server-side ad insertion (SSAI) to create monetized linear channels with personalized advertising. This powerful integration enables you to deliver targeted ads to different viewers watching the same channel content, increasing your revenue opportunities while maintaining a broadcast-quality viewing experience. For information about SSAI with CDNs, see [Ad insertion with CDN](ssai-cdn-workflow.md).

In this topic, we use the term *manifests* to refer collectively to multivariant playlists, media playlists, and MPDs.

For more information about MediaTailor channel assembly, see [Using AWS Elemental MediaTailor to create linear assembled streams](channel-assembly.md). 

## What you'll need
<a name="ca-cdn-what-you-need"></a>

Before setting up MediaTailor channel assembly with a CDN, gather these required resources:

**AWS account and permissions**  
An AWS account with appropriate permissions to create and manage MediaTailor resources  
IAM permissions for MediaTailor, CloudFront (if using), and related services  
For detailed permission requirements, see [Security in AWS Elemental MediaTailor](security.md).

**Required services**  
A running MediaTailor channel assembly channel (not just an SSAI configuration)  
A content delivery network (CDN) account (Amazon CloudFront or third-party CDN)  
Origin storage for your VOD content (Amazon S3, MediaPackage, or other origin server)

**Content requirements**  
VOD sources properly encoded and packaged in HLS or DASH format. For information about working with source locations and VOD sources, see [Working with source locations](channel-assembly-source-locations.md).  
Content with consistent segment durations (recommended minimum: 1 second)  
Ad slate content for ad breaks (if implementing ad insertion). For information about configuring slate, see [MediaTailor slate ad insertion](slate-management.md).

## Before you begin
<a name="ca-cdn-before-you-begin"></a>

**Important**  
This workflow requires a running MediaTailor channel assembly channel. Having only a MediaTailor SSAI configuration is not sufficient for this integration. You must have an active channel assembly channel configured and operational before proceeding with CDN integration.

Complete these setup tasks before implementing MediaTailor channel assembly with a CDN:

1. Configure network connectivity between your CDN, MediaTailor, and origin servers

1. Set up HTTPS for secure content delivery

1. Configure DNS settings for your CDN domain

### Knowledge prerequisites
<a name="ca-cdn-knowledge-prerequisites"></a>

To successfully implement this solution, you should have:
+ Understanding of streaming protocols (HLS/DASH)
+ Basic knowledge of CDN configuration principles
+ Familiarity with MediaTailor channel assembly concepts

For basic MediaTailor setup, refer to [Setting up](setting-up.md) and [Getting started with MediaTailor channel assembly](channel-assembly-getting-started.md). For information about working with source locations and VOD sources, see [Working with source locations](channel-assembly-source-locations.md). For information about configuring slate, see [MediaTailor slate ad insertion](slate-management.md).

## Benefits of CDN integration
<a name="ca-cdn-benefits"></a>

Integrating channel assembly with a CDN delivers these key benefits.

**Improved viewer experience**  
Properly configured CDNs reduce buffering, startup times, and playback errors for linear channels. This results in higher viewer engagement and satisfaction.

**Cost reduction**  
Efficient caching strategies minimize origin requests. This reduces data transfer costs and origin server load, particularly important for high-volume linear channels.

**Scalability**  
Optimized CDN configurations handle traffic spikes during popular events without degrading performance, ensuring your linear channels remain available even during peak viewing times.

**Global reach**  
Properly configured CDNs deliver content with low latency to viewers worldwide, regardless of their location, expanding your potential audience.

**Seamless program transitions**  
Optimized CDN configuration ensures smooth transitions between programs in your linear channel, creating a broadcast-quality viewing experience.

**Topics**
+ [What you'll need](#ca-cdn-what-you-need)
+ [Before you begin](#ca-cdn-before-you-begin)
+ [Benefits of CDN integration](#ca-cdn-benefits)
+ [Understand CDN architecture](channel-assembly-cdn-architecture.md)
+ [Basic setup](ca-cdn-setup-basic.md)
+ [Configure base URLs](channel-assembly-cdn-baseurl.md)
+ [Implement ad insertion](ca-cdn-setup-advanced.md)
+ [Configure time-shifted viewing](channel-assembly-cdn-timeshift.md)
+ [Monitor CDN operations](ca-cdn-monitor.md)
+ [Complete optimization guide](ca-cdn-optimize-reference.md)

# Understand MediaTailor channel assembly CDN architecture
<a name="channel-assembly-cdn-architecture"></a>

AWS Elemental MediaTailor channel assembly integrates with content delivery networks (CDNs) to deliver linear streaming channels with improved performance and global reach. The recommended architecture positions the CDN between viewers and channel assembly, with channel assembly accessing content directly from your origin. This topic explains the core architecture components and how they work together to deliver your content.

1. Viewers request manifests from the CDN

1. CDN forwards requests to channel assembly

1. Channel assembly assembles the manifests from VOD sources

1. Channel assembly returns the manifests to the CDN, which forwards them to viewers

1. Viewers request segments through the CDN

1. CDN routes segment requests to the appropriate origin

This architecture ensures optimal performance while maintaining the security and flexibility benefits of using a CDN.

![\[Diagram showing CDN positioned between client players and MediaTailor Channel Assembly\]](http://docs.aws.amazon.com/mediatailor/latest/ug/images/ca-cdn.png)


## CDN terminology for channel assembly
<a name="cdn-terminology"></a>

Understanding these key terms will help you implement and troubleshoot your channel assembly CDN integration:

Origin CDN and edge CDN  
**Origin CDN**: A CDN positioned between MediaTailor and your content origin. It caches content segments to reduce load on your origin servers. In a multi-CDN architecture, this is the first CDN layer that interfaces directly with the origin.  
**Edge CDN**: A CDN positioned between viewers and MediaTailor. It delivers personalized manifests and content to viewers. In a multi-CDN architecture, this is the outermost CDN layer that interfaces directly with viewers.

CDN configuration terms  
**Cache behavior**: Rules that determine how a CDN handles different types of requests, including caching duration and origin routing.  
**TTL (Time To Live)**: The duration for which content remains valid in a CDN cache before it needs to be refreshed from the origin. For detailed TTL recommendations, see [Caching optimization for CDN and MediaTailor integrations](cdn-optimize-caching.md).  
**Cache key**: The unique identifier used by a CDN to store and retrieve cached content, often including URL path, query parameters, and headers.  
**Origin shield**: An intermediate caching layer between CDN edge locations and your origin server that reduces the number of requests to your origin.  
**Request collapsing**: A CDN feature that combines multiple simultaneous requests for the same content into a single origin request.

MediaTailor-specific CDN terms  
**CDN content segment prefix**: The CDN domain name that MediaTailor uses when generating URLs for content segments in manifests.  
**CDN ad segment prefix**: The CDN domain name that MediaTailor uses when generating URLs for ad segments in manifests.

For more information about CDN configuration with MediaTailor, see [Set up CDN integration](cdn-configuration.md).

# Set up basic MediaTailor channel assembly with a CDN
<a name="ca-cdn-setup-basic"></a>

AWS Elemental MediaTailor channel assembly enables you to configure a basic integration with your content delivery network (CDN) for efficient delivery of linear streaming channels to your viewers. Follow these steps to set up the integration between channel assembly and your CDN.

1. Configure your CDN to accept manifests from viewers and forward them to MediaTailor channel assembly.

1. Set up MediaTailor channel assembly to access your channel schedule and determine the current programming.

1. Configure MediaTailor channel assembly to request content segments from your origin server based on the schedule.

1. Ensure your content origin can deliver the requested segments to MediaTailor channel assembly.

1. Set up MediaTailor channel assembly to generate dynamic manifests based on the current schedule.

1. Configure your CDN to deliver the assembled multivariant playlists, media playlists, and MPDs to viewers.

1. Set up your CDN to handle segment requests from viewers, with appropriate cache settings.

1. Configure your CDN to forward cache misses to MediaTailor channel assembly.

1. Set up MediaTailor channel assembly to retrieve requested segments from your content origin.

1. Configure your CDN to deliver content segments to viewers for playback.

# Configure base URLs for MediaTailor channel assembly CDN
<a name="channel-assembly-cdn-baseurl"></a>

AWS Elemental MediaTailor channel assembly requires proper base URL configuration to ensure content routing through your content delivery network (CDN) works correctly. Configure the base URL settings in channel assembly to enable successful content delivery to viewers.

## Content segment URL configuration
<a name="channel-assembly-cdn-content-segment"></a>

In your channel assembly channel configuration, set the **Base URL** to your CDN domain. This ensures that all segment URLs in the assembled manifest point to your CDN rather than directly to your origin server.

For example, if your origin content is at `http://origin.example.com/content/` and your CDN domain is `https://cdn.example.com/`, set the Base URL to `https://cdn.example.com/content/`.

## Access restriction configuration
<a name="channel-assembly-cdn-access-restriction"></a>

To enhance security, configure your CDN to restrict direct access to your origin server:

1. Set up origin access controls in your CDN.

1. Configure your origin server to only accept requests from your CDN.

1. Use signed URLs or cookies for viewer authentication if needed.

For Amazon CloudFront, you can use Origin Access Control (OAC) to secure access to your origin. For more information about securing your CloudFront integration, see [CloudFront integration](cloudfront-specific-recommendations.md).

# Implement MediaTailor ad insertion with channel assembly
<a name="ca-cdn-setup-advanced"></a>

Channel assembly in AWS Elemental MediaTailor integrates seamlessly with server-side ad insertion (SSAI) and content delivery networks (CDNs) to create monetized linear channels with personalized advertising.

When you combine channel assembly with SSAI, you can build linear channels that deliver personalized ads to viewers while maintaining broadcast-quality experiences. This integration enables you to do the following:
+ Monetize content - Generate revenue through targeted advertising in your linear channels
+ Personalize experiences - Deliver different ads to viewers watching the same channel based on their profiles
+ Maintain quality - Ensure seamless transitions between content and ads for broadcast-quality viewing
+ Scale efficiently - Support millions of concurrent viewers through CDN delivery

For detailed information about SSAI with CDNs, see [Ad insertion with CDN](ssai-cdn-workflow.md).

1. Configure your edge CDN to accept manifest requests from viewers and forward them to MediaTailor ad insertion.

1. Set up MediaTailor ad insertion to forward requests to your origin CDN.

1. Configure your origin CDN to forward requests to MediaTailor channel assembly.

1. Set up MediaTailor channel assembly to generate dynamic manifests based on the current schedule.

1. Configure your origin CDN to forward the assembled manifests to MediaTailor ad insertion.

1. Set up MediaTailor ad insertion to request ad decisions from your ad decision server at ad break points.

1. Configure MediaTailor ad insertion to personalize manifests with ad markers.

1. Set up your edge CDN to deliver personalized manifests to viewers.

1. Configure your CDN architecture to handle both content and ad segment requests efficiently.

The following diagram illustrates this combined workflow:

![\[Diagram showing CDN integration with both channel assembly and ad insertion\]](http://docs.aws.amazon.com/mediatailor/latest/ug/images/ca-ssai-comb-cdn.png)


For optimal performance when combining channel assembly and SSAI:
+ Configure cache behaviors that distinguish between channel assembly and SSAI requests
+ Set appropriate TTL values for manifests and segments as recommended in [Caching optimization for CDN and MediaTailor integrations](cdn-optimize-caching.md)
+ Ensure proper routing between channel assembly, ad insertion, and your CDN origins
+ Monitor the performance metrics for both channel assembly and ad insertion components

For detailed information about configuring SSAI with CDNs, see:
+ [Understand ad insertion architecture for CDN and MediaTailor integrations](ssai-cdn-architecture-overview.md) - Learn about SSAI architecture and concepts
+ [Set up basic MediaTailor SSAI with a CDN for optimal ad delivery](configuring-ssai-cdn.md) - Step-by-step SSAI configuration instructions
+ [Troubleshoot MediaTailor SSAI with CDNs for uninterrupted ad delivery](troubleshooting-ssai-cdn.md) - Troubleshoot common SSAI integration issues

# Configure time-shifted viewing for MediaTailor channel assembly
<a name="channel-assembly-cdn-timeshift"></a>

AWS Elemental MediaTailor channel assembly supports time-shifted viewing capabilities that enable DVR-like functionality such as pause, rewind, and start-over for your linear channels. Enable these features by configuring your content delivery network (CDN) to support time-shifted viewing, which allows viewers to control their viewing experience.

## Understanding time-shifted viewing
<a name="channel-assembly-cdn-timeshift-overview"></a>

Time-shifted viewing enables DVR-like functionality for linear channels, including:
+ **Start-over**: Viewers can start watching a program from the beginning, even if they join after it has started
+ **Pause and resume**: Viewers can pause content and resume watching later
+ **Rewind and fast-forward**: Viewers can navigate backward and forward through available content
+ **Delayed viewing**: Viewers can watch content that aired earlier in the channel's schedule

Time-shifted viewing works by adding a `start` parameter to the channel's playback URL. The parameter specifies an offset in seconds relative to the current time:
+ Negative values indicate a time in the past (such as `start=-3600` means "start from 1 hour ago")
+ Positive values indicate a time in the future (such as `start=3600` means "start from 1 hour in the future")

Example URL with time-shift parameter:

```
https://example-cdn.com/out/v1/channel-name/index.m3u8?start=-3600
```

## Time delay resolution
<a name="channel-assembly-cdn-timeshift-delay"></a>

To support time-shifted viewing with a CDN:

1. Configure your CDN to forward the `start` query parameter to channel assembly.

1. Set up cache behaviors that include the `start` parameter in the cache key.

1. For manifests with time-shift parameters, use a short TTL or no caching.

This ensures that each viewer receives the correct manifest for their requested time position.

## CDN requirements for time-shifting
<a name="channel-assembly-cdn-timeshift-requirements"></a>

Your CDN must meet these requirements to support time-shifted viewing with channel assembly:
+ Forward all query parameters to channel assembly.
+ Include the `start` parameter in the cache key.
+ Support proper cache invalidation for time-shifted manifests.
+ Handle varying manifest responses based on query parameters.

# Monitor MediaTailor channel assembly CDN operations
<a name="ca-cdn-monitor"></a>

AWS Elemental MediaTailor channel assembly requires effective monitoring when integrated with a content delivery network (CDN) to ensure reliable content delivery. Implement monitoring strategies for your channel assembly and CDN integration to help ensure reliable content delivery and quick problem resolution.

For comprehensive CDN monitoring guidance including essential metrics, monitoring tools setup, alert configuration, and troubleshooting strategies that apply to all MediaTailor implementations, see [CDN monitoring](cdn-monitoring.md). This section focuses on channel assembly-specific monitoring requirements.

Implement specific monitoring for your channel assembly and CDN integration:
+ Track manifest generation metrics in channel assembly.
+ Monitor time-shifted viewing requests and their impact on CDN cache hit rates.
+ Configure alerts for unusual patterns in manifest requests.
+ Implement tracking for segment availability across your content sources.

For Amazon CloudFront, create a dashboard that integrates CDN metrics with MediaTailor metrics to visualize your entire delivery pipeline using [CloudWatch dashboards](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html).

If you're also using SSAI with your channel assembly, see [Monitor CDN operations](ssai-cdn-monitor.md) for additional monitoring recommendations specific to ad insertion.

# Complete channel assembly CDN optimization
<a name="ca-cdn-optimize-reference"></a>

For detailed CDN optimization guidance specific to channel assembly implementations, including caching strategies, request routing configuration, performance benchmarks, and advanced optimization techniques, see [CDN performance optimization](cdn-optimization.md).

The consolidated optimization guide provides:
+ Channel assembly-specific caching settings with recommended TTL values
+ Request routing optimization for manifest and segment delivery
+ Performance benchmarks and targets for all MediaTailor implementations
+ Advanced optimization techniques including Origin Shield and compression
+ Combined workflow guidance for channel assembly with SSAI