integrating amazon cloudfront.md

Integrate Amazon CloudFront

For production workloads that require global reach, consistent low latency, or more than a few hundred concurrent viewers, you can place Amazon CloudFront in front of your streaming endpoint.

CloudFront acts as the CDN layer: viewer requests hit CloudFront edge nodes globally, which cache content and forward cache misses to your MK.IO streaming endpoint as the origin. This reduces load on the endpoint and lowers latency for viewers worldwide.

How it fits together

Viewer → CloudFront Edge → MK.IO Streaming Endpoint → Your Cloud Storage

Your playback URLs change from pointing directly at the MK.IO endpoint to pointing at your CloudFront distribution domain. The assets, locators, and streaming policies in your MK.IO workflow stay the same.

Prerequisites

Create a CloudFront distribution

Open CloudFront in the AWS Console

Sign in to the AWS Console and navigate to CloudFront. Click Create distribution.

Set the origin

The origin is your MK.IO streaming endpoint hostname.

Configure the default cache behaviour

Configure distribution settings

Create the distribution

Click Create distribution. CloudFront assigns a distribution domain in the format <id>.cloudfront.net. Wait for the Last modified field to update before testing the distribution.

Update your playback URLs

Once the distribution is active, replace the MK.IO streaming endpoint hostname in your playback URLs with the CloudFront domain:

Before (direct to MK.IO endpoint):

https://<endpoint-name>.<region>.streaming.mediakind.com/<locator-id>/...

After (via CloudFront):

https://<id>.cloudfront.net/<locator-id>/...

If you configure a custom domain in CloudFront, use that domain instead.

Custom domain (optional)

To use your own domain (for example, cdn.example.com) instead of the .cloudfront.net domain:

  1. Request a certificate for your domain in AWS Certificate Manager (ACM) in the us-east-1 region. CloudFront requires certificates in this region regardless of where your content is hosted.
  2. In your CloudFront distribution, add your domain under Alternate domain names (CNAMEs) and attach the ACM certificate.
  3. In your DNS provider, create a CNAME record pointing your domain to the .cloudfront.net distribution domain.

For detailed steps, see the AWS CloudFront custom domains documentation.