Live HTTP Streaming Using CloudFront and Any HTTP Origin
With Amazon CloudFront live streaming, you can use any live encoder, such as Elemental Live, that outputs HTTP-based streams to stream live performances, webinars, and other events. This tutorial walks you through the process of configuring live streaming.
This tutorial assumes that you have already set up your live encoder.
Creating a New CloudFront Distribution for Live Streaming
The following procedure uses an AWS CloudFormation template to create a new CloudFront distribution that you will use for your live stream.
To create a new CloudFront distribution for live streaming
Go to the Amazon Web Services page, and sign in using your Amazon.com account or create a new account.
To start the wizard that creates a new CloudFront distribution, choose the following link:
On the Select Template page, choose Next.
On the Specify Details page, type the following values:
- Stack name
Type a descriptive name for your live streaming stack, or accept the default name.
Type the DNS name of the custom origin that CloudFront will get the live feed from.
Type the HTTP TCP port that you want CloudFront to use to communicate with your custom origin.
Type a comment to help you identify your distribution, which is useful if you manage multiple distributions. The value that you type here appears in the CloudFront console.
(Optional) On the Options page, add the key-value pairs for any tags you plan to use. In addition, to configure SNS notification, to specify how long you're willing to wait for the stack to be created, to choose whether to roll back changes if stack creation fails, and to enter a stack policy, choose Advanced, and adjust settings as desired. For more information, see Setting AWS CloudFormation Stack Options.
Review the settings for the stack, and then choose Create. AWS CloudFormation creates the stack.
Creating your stack creation might take several minutes. To track the progress of stack creation, select the stack, and then choose the Events tab. If AWS CloudFormation cannot create the stack, the Events tab lists error messages.
When your stack is ready, in the list of stacks, the status for the stack changes to CREATE_COMPLETE.
When your stack is created, choose the Outputs tab, which will display the CloudFront domain name. You'll need this value when you set up the live stream playback in your web player.
Configuring Web Players to Play the Live Stream
To play the live stream, embed the manifest URL in the players that your users will play your live stream with. For example, to play a live stream for which the manifest file is myStream/playlist.m3u8 and the CloudFront distribution is d111111abcdef8.cloudfront.net, you embed the following URL in players:
(Optional) Deleting an AWS CloudFormation Stack for Live Streaming
When your live event is over, delete the stack that you created for live streaming. This deletes the CloudFront distribution that you created for your live-streaming event.
When you stop streaming, you also stop incurring CloudFront charges for this distribution. There are no charges for the AWS CloudFormation stack.
To delete an AWS CloudFormation stack for live streaming
Sign in to the AWS Management Console and open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation/.
In the upper-right corner, choose the region in which you created your stack.
Select the stack, and then choose Delete Stack.
Choose Yes, Delete to confirm.
To track the progress of the stack deletion, select the stack, and then choose the Events tab.