Sustainable Workflow using MediaLive
January 11, 2024 · View on GitHub
Log
| Date | Entry | Version | Comment |
|---|---|---|---|
| 24/01/2022 | created | 0.0.1 | initial release of the application |
| 24/08/2023 | update | 0.0.2 | Change CDK app formatting |
Disclaimer
The sample code; software libraries; command line tools; proofs of concept; templates; or other related technology is provided to you as AWS Content under the AWS Customer Agreement, or the relevant written agreement between you and AWS (whichever applies). You are responsible for testing, securing, and optimizing the AWS Content, such as sample code, as appropriate for production grade use based on your specific quality control practices and standards. You should not use this AWS Content in your production accounts, or on production or other critical data. Deploying AWS Content may incur AWS charges for creating or using AWS chargeable resources, such as running AWS Elemental Live Channels or using AWS Elemental MediaPackage.
Table of content
- Solution overview
- Use case
- Architecture
- CDK deployment
- Deployment
- Known issues
- File structure
- Tutorial
- License
Solution overview
Media Services reference architecture to demonstrate the following:
- Single encode shared between 2 outputs on MediaLive - distributing to both MediaPackage and MediaConnect to show multiple outputs (but same encode)
- MediaLive output to MediaConnect flow using RTP-FEC - demonstrating output to MediaConnect for encode/output distribution to other destinations such as Partners, Distributors or other regions.
Use Case & Benefits
Please see the latest blog published here.
Sustainability
AWS has always been focused on improving efficiency in every aspect of our infrastructure. From the highly available infrastructure that powers our servers, to techniques we use to cool our data centers, and the innovative server designs that deliver AWS services to our customers—energy efficiency is a primary goal of our global infrastructure.
AWS also provides customers with several tools to help them meet their sustainability goals. For example, the AWS customer carbon footprint tool calculates the carbon emissions generated from AWS usage, enabling customers to incorporate their AWS carbon footprint into their own sustainability reporting.
For more information visit our page on Sustainability.
Architecture
Code Sample Architecture

CDK deployment
Visit our AWS cloud Development Kit for more information on CDK. Get hands-on with CDK running the CDK introduction workshop. For this project we will make use of Typescript version of CDK. We will create a Typescript app using CDK, this app will abstract all the CloudFormation stack and resource creation. More information on CDK best practice can be found on AWS website.
Requirements
- Create an AWS account if you do not already have one and log in. The IAM user that you use must have sufficient permissions to make necessary AWS service calls and manage AWS resources.
- AWS CLI installed and configured
- Git Installed
- AWS Cloud Development Kit (AWS CDK >= 2.2.0) Installed
- Language used: Typescript
- Framework: AWS CDK
Deployment Instructions
- Create a new directory, navigate to that directory in a terminal and clone the GitHub repository:
git clone https://github.com/aws-samples/aws-cdk-mediaservices-refarch
- Change directory to the pattern directory:
cd
- Install node modules:
npm install
-
Create a bucket in your account, and upload a file to be used as input on the workflow
-
Update your configuration in
config.tsto work in your account - you will need to provide the bucket name and file name created/uploaded in the previous step. -
Build CDK App
npm run build
- Deploy Media Stack
npm run cdk deploy MediaServicesRefArch-sustainable-workflow
Running the solution
Once your system is deployed and configured correctly with the right downstream origin/system - you'll need to start the following:
- MediaConnect flow
- MediaLive channel
Cleanup
-
Stop MediaLive channel
-
Stop MediaConnect Flows
-
Delete the stack
Tutorial
See this useful workshop on working with the AWS CDK for typescript projects. More about AWS CDK v2 reference documentation here.
Useful commands
npm run buildcompile typescript to jsnpm run watchwatch for changes and compilenpm run testperform the jest unit testscdk lslist all stacks in the appcdk synthemits the synthesized CloudFormation templatecdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk docsopen CDK documentationcdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk synthemits the synthesized CloudFormation template
Best practice
- Security: Content security is key to the success of a streaming platform. So make sure to make use of encryption at rest for your assets with the bucket encryption capabilities and secure the transport of your content with https or s3ssl protocols. Ensure you have authentication and authorization in place at a level commensurate with the sensitivity and regulatory requirements of your assets. Consider using MFA whenever possible to access your resources. Where possible access logging should also be enabled and encrypted.
- Reliability: For demos and debugging purpose this solution run a single pipeline to process your content. However, in a production environment make sure to remove any single point of failure by using the STANDARD mode which allows for dual pipeline creation to process your content in the cloud.
- Operation: Enabling logs on the channel will give you more insight on what is happening in your infrastructure should you need to investigate any issue. You can enhance your CDK application with API calls to automate operational tasks based on triggers.
- Cost: Review your encoding settings to optimize your ABR ladder. Consider reservation for 24/7 workflow. Make use of bandwidth optimized control rate such as QVBR to save bandwidth on CDN usage when possible.
License
This library is licensed under the MIT-0 License. See the LICENSE file.