We recently published a quick-start guide detailing how to publish an HLS live stream to S3 for testing purposes. If you’d like to take it a step further, you can use CloudFront as a CDN with no additional commitment. This guide assumes you’ve already gone through the Live to S3 quickstart guide and have that working.
First we need to set up our CloudFront distribution. Log into your AWS console and go to your CloudFront dashboard. Click “Create Distribution” in the top left corner.
You should now see two delivery method options. You might be tempted to select the “Streaming” option, but that’s specifically for the RTMP protocol. What we want in this case is “Download”, so make sure that’s selected and click “Continue”.
When you click the input box for “Origin Domain Name”, you will see a drop down menu of your available S3 buckets. Select the one you used in the Live to S3 quickstart guide, and the “Origin ID” field will automatically be populated. “Restrict Bucket Access” allows you to make it so people can only access your bucket through CloudFront. Because we’ll want to be able to view both for testing later, leave this disabled.