Skip to main content
Version: 2.17

Amazon CloudFront Integration with Ant Media Server

A content delivery network (CDN) is a geographically distributed network of proxy servers and data centers. The goal of a CDN is to provide high availability and performance by distributing content closer to end users.

This guide explains how to configure Amazon CloudFront to deliver HLS and LL-HLS streams from Ant Media Server.

What is Amazon CloudFront?

Amazon CloudFront is a web service that speeds up the distribution of static and dynamic web content. CloudFront delivers content through a global network of edge locations, automatically routing requests to the nearest location to reduce latency.

Prerequisites

Before configuring CloudFront, ensure you have:

Configure Amazon CloudFront

Create a Distribution

  1. Log in to your AWS account and open the Amazon CloudFront console.

  2. Click Create Distribution.

    cloudFront-console

  3. Configure the origin:

    origin

    • Origin domain: Enter the domain name of your Ant Media Server instance.
    • Protocol: Choose HTTP (5080) or HTTPS (5443). If you select HTTPS, ensure SSL is enabled.
    • Origin path: Enter the name of your Ant Media Server application (e.g., live).
  4. Configure the default cache behavior:

    • Set cache behavior settings and policies as needed.

      default-cache

    • Attach a cache policy and origin request policy.

      cache-policy

  5. Disable the Web Application Firewall (WAF) protection for this distribution if not required.

    disable-waf

  6. Complete creation of the distribution and wait for it to deploy.

Configuring Error Pages

  1. In the CloudFront console, open your distribution and go to the Error Pages tab.

    error-pages

  2. Create a custom error response for 404: Not Found.

    • Set Error Caching Minimum TTL to 3 seconds.

      custom-error-response

  3. Once deployed, note your CloudFront domain name.

    cloudfront

Publish a Live Stream with Ant Media Server

  1. Follow the Publish Live Stream guide to start a stream.
  2. For this example, publish an RTMP stream using OBS.

Play the Live Stream with HLS

Use the following format for HLS playback:

http://your_cloud_front_domain_name/play.html?id=your_stream_id&playOrder=hls

Example:

http://d3m1pdd4lln4vj.cloudfront.net/play.html?id=stream01&playOrder=hls

cloudfront-play

Play the Live Stream with LL-HLS

Use the following format for LL-HLS playback:

http://your_cloud_front_domain_name/play.html?id=your_stream_id&playOrder=ll-hls

Example:

http://d3m1pdd4lln4vj.cloudfront.net/play.html?id=stream001&playOrder=ll-hls

ll-hls-play


Congratulations! 

By completing these steps, you have:

  • Deployed Ant Media Server on AWS.
  • Configured Amazon CloudFront to deliver HLS and LL-HLS streams.
  • Published and tested playback of live streams through CloudFront.

You can now deliver live video globally with reduced latency and improved reliability using Amazon’s CDN infrastructure.