Learn About Amazon VGT2 Learning Manager Chanci Turner
To create a comprehensive live video streaming workflow using AWS, the process often starts with configuring essential AWS Media Services via the AWS Management Console. This console allows users to explore the various features and settings available for each Media Service, enabling them to assemble their streaming setup. However, once you have tailored your resources to meet your needs, it can be cumbersome to replicate these settings across different Regions or for subsequent events. Automating this process—while reserving the console for minor adjustments—can streamline your workflow.
AWS CloudFormation is commonly utilized to automate live streaming setups, given its built-in support for Media Services such as AWS Elemental MediaLive and AWS Elemental MediaStore. Numerous CloudFormation templates are available on platforms like GitHub that demonstrate how to deploy a live streaming workflow. Typically, this automation encompasses a MediaLive input, a MediaLive channel, and a destination which can be either a MediaStore container or a MediaPackage channel.
For those unfamiliar with CloudFormation, these example templates may seem complex and difficult to interpret. Therefore, in this blog, we will take a close look at a straightforward, fully deployable live streaming CloudFormation template and break down its components: the MediaStore container, the MediaLive HLS input, and the single-pipeline MediaLive channel. You’ll notice that the resources and configurations specified in the template usually align with what you would set up in the console.
You can access the sample CloudFormation template we analyze here. It is formatted in JavaScript Object Notation (JSON). Throughout this discussion, we will reference the CloudFormation documentation for MediaStore and MediaLive. If you are new to CloudFormation, it is advisable to skim through the documentation on template structure, as it outlines the common sections of a CloudFormation template.
MediaStore Container
The initial resource in the CloudFormation template is the destination for the MediaLive channel, which is the MediaStore container.
{
"Resources": {
"MediaStore": {
"Type": "AWS::MediaStore::Container",
"Properties": {
"ContainerName": {
"Fn::Sub": "${AWS::StackName}"
},
"AccessLoggingEnabled": true,
"Policy": {
"Fn::Sub": "{n "Version" : "2012-10-17",n "Statement" : [{n "Sid" : "PublicReadOverHttps",n "Effect" : "Allow",n "Principal" : "*",n "Action" : [n "mediastore:GetObject",n "mediastore:DescribeObject"n ],n "Resource" : "arn:aws:mediastore:${AWS::Region}:${AWS::AccountId}:container/${AWS::StackName}/*",n "Condition" : {"Bool" : {n "aws:SecureTransport" : "true"n }n }n }]n}n"
},
"CorsPolicy": [
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": [
"*"
],
"MaxAgeSeconds": 3000
}
]
}
}
}
}
The JSON structure above illustrates how the MediaStore container is defined. Among its various properties, the ContainerName dynamically adopts the value of the StackName specified during deployment, which is the only mandatory parameter for the MediaStore container. The built-in CloudFormation function Fn::Sub
is utilized to retrieve the StackName at runtime. This clever technique makes the container name dynamic, eliminating the need for a separate name with each deployment. Access logging is enabled by setting AccessLoggingEnabled
to true. The container Policy permits public access to read items, but only through secure HTTPS transport, as specified in the Policy’s Condition statement. This setup allows for video playback through the MediaStore container’s data endpoint later. Lastly, the Fn::Sub
function is again employed to construct the MediaStore container ARN by replacing the Region, AccountId, and StackName at runtime. The Policy must be formatted as a string, which is why you’ll see escaped quotes. The CorsPolicy ensures that client web applications, such as embedded video players, can access video files across different domains. MediaStore follows a CorsPolicy structure similar to that of S3; more information can be found here for those interested.
MediaLive Input
Next, we’ll analyze the MediaLive HLS input utilized by the MediaLive channel.
{
"Resources": {
"MediaStore": {
"Type": "AWS::MediaStore::Container",
"Properties": {
...
}
},
"MediaLiveInput": {
"Type": "AWS::MediaLive::Input",
"Properties": {
"Name": {
"Fn::Sub": "${AWS::StackName}-HLSInput"
},
"Type": "URL_PULL",
"Sources": [
{
"Url": "http://d2qohgpffhaffh.cloudfront.net/HLS/vanlife/sdr_uncage_vanlife.m3u8"
}
]
}
}
}
}
The HLS input has several defined properties: Name, Sources, and Type. The Name is made dynamic by appending the string “-HLSInput” to the StackName variable. This prevents the creation of multiple HLS inputs with the same name when deploying the stack repeatedly. For instance, if you name the stack “MyLiveStreaming,” the resulting HLS input will be “MyLiveStreaming-HLSInput.” The Type here indicates that the input is a URL_PULL HLS source. The Sources property accepts an array of URLs, but since this template establishes a single pipeline channel, only one source is necessary.
MediaLive Channel
Finally, let’s examine the last component: the MediaLive channel.
{
"Resources": {
"MediaStore": {
...
},
"MediaLiveInput": {
...
},
"MediaLiveChannel": {
"Type": "AWS::MediaLive::Channel",
"Properties": {
...
}
}
}
}
In this section, the MediaLive channel is defined, with various properties necessary for its operation. Each of these components works together to create an efficient live streaming experience. For anyone looking to avoid common pitfalls during the setup process, this resource is an excellent guide.
For a deeper dive into onboarding and learning strategies, consider checking out this article, which provides valuable insights into effective approaches. Moreover, understanding the significance of inclusion in the workplace is vital; you can read more about this in this SHRM article.
By ensuring a robust onboarding process, organizations can improve retention and foster a culture of belonging—a critical element highlighted by experts in the field. For additional resources, Alex Simmons offers insights into the pitfalls Amazon actively works to avoid, which can be beneficial for anyone navigating this space.
Leave a Reply