Setting Up a Scalable Live Video Streaming Platform with AWS

Abhi
4 min readMar 1, 2021

--

As a part of my profession, I have been working with on-premises setup for VoD (Video on Demand) and Live Streaming projects for Govt. & private firms, Setting up service was easy but proper content delivery was cumbersome !!

  1. Here we discuss a solution for large scale streamers
  2. Also, a solution is for small scale deployment -> link

Set CDN as a priority (if your client is on another continent)

Amazon CloudFront is a fast content delivery network (CDN) service that securely delivers data, videos, applications, and APIs to customers globally with low latency, high transfer speeds, all within a developer-friendly environment.
-AWS

It’s mostly a marketing feature for small-scale products because ISPs offer better bandwidth than end-users network conditions.

CloudFront is integrated with AWS — both with physical locations that are directly connected to the AWS global infrastructure, as well as other AWS services. When end users request an object using this domain name, they are automatically routed to the nearest edge location for high-performance delivery of your content.

In AWS,

Step1. Open AWS account & set your region
Step2. open AWS Elemental MediaPackage

  1. Create channel,
    ID — required*
    Description — Provide a detailed description
    Input type — APPLE HLS
    Put a Checkmark for — Create a CloudFront distribution for this channel
We will be using these URLs, usernames, and passwords in AWS Elemental MediaLive console to connect MediaPackage service.

Step3. Open Up AWS Elemental MediaLive

  1. Create Input source (from left side panel)
    1. Click “Create input
    2. Provide “Input name” to later identify the source,
    a. Select “RTMP (push)” if you are using FFmpeg / OBS for streaming live video — or — select “MP4” to upload from S3 bucket/storage servers for VoD applications.
    b. In “Input security group” provide your source server Static IP — or — provide with 0.0.0.0/0 if your FFmpeg/OBS doesn’t have a Static IP.
    c. “Input destinations” is the URL you would require FFmpeg/OBS to stream into. This URL will have 3 parts — URL, key, and value.

2. After Saving “Inputs”, now let’s create a new channel to read and process the input stream.
1. In “Channel and input details” the most important parameter is to provide a proper “IAM role”. You have to create a role and then attach it as an existing role

3. From “Channel template” select “Live Event — HLS” to use a generic inbuild template.
4. Now Add an entry in the “Input attachments”, Just select Input stream from the drop-down list and that’s it.
5. Setting up “Output groups” is a little tricky as you have to copy-paste parameters from AWS Elemental MediaPackage accordingly.

Copy-paste Urls, username, and password from MediaPackage channels to HLS group destination A and HLS group destination B

Finally, on clicking the Update channel button, AWS will evaluate and validate your parameters, AMI roles. This will automatically spawn an endpoint URL in the MediaPackage console, copy the CloudFront URL and attach it to your front end code for live streams.

Step4. To test live stream…

Fire up OBS/FFmpeg, AWS Elemental MediaLive and move to the “Inputs” section, copy any one of the URL and attach to the OBS streaming settings or append to the FFmpeg command

Then to see a preview of a broadcasted video stream over the web click on the “Play” button in the channel inside AWS MediaPackage Console.

Voila, Youtube grade video streaming service is ready!!

You would always have an option to opt for opensource alternatives, where you can optimize for your requirements (link- https://mails2abhinand.medium.com/live-streaming-rtmp-video-through-https-7430e3e3bfda)

--

--

Abhi

Hello world, Basically a Linux evangelist, Working as a DevOps engineer — ♥ www.abhinand.in/