How to Serve On-Demand Streaming Videos from AWS (Build Your Own Netflix)

andrewbrown profile image Andrew Brown 🇨🇦 ・1 min read

⚠️ DEV.to video player is in beta doesn't play for people resulting in an error code but do not worry because we also upload our videos to youtube so here is the youtube link to this video.. If you do happen to go to our YouTube consider giving us a subscribe because it helps us to produce more free video content.

So at ExamPro, we have lots of video content and instead of using an existing provider to serve On-Demand Video Streaming we rolled our own on AWS. This allows us to have full control over the data and also allows us to have a video pipeline for pennies than using a third party provider.

Posted on Apr 13 '19 by:

andrewbrown profile

Andrew Brown 🇨🇦


🚀 CEO of ExamPro 🚀 free AWS Certification courses on freeCodeCamp youtube 🚀 AWS Community Hero 🚀 DEV Moderator for AWS tag 🚀 Star Trek Obsessed


We create cloud certification courses. Videos, Quizlets, Flashcards, Cheatsheet and Practice Exams!


markdown guide

Seems you and I have similar thought process @andrew ; I am doing this exact same thing for a project. It is great how the services and be configured and linked together. Like LEGO's for software people. :D


We spent at least 1 week with AWS Support on ClouldFront to get this working. It was quite the challenge. Getting Signed Cookies with correct the headers and the CORS all working was configuration hell, but we got through it.


I messed with S3+CORS a few years back. Still have nightmares about it...


How to make your own Youtube

Its how to build your own "Netflix" and I was deliberate in my wording to not use Youtube because the strategy to keep costs low for publically available videos of larger quantity is different in that I would recommend provisioning your own transcoding servers to lower costs than using AWS managed transcoding services.

It's cheaper to use a CDN for the streaming

We are using a CDN for streaming which does keep costs low. That's CloudFront

it's only mp4 to DASH without multiple bitrates and resolutions thats not CPU intensive and can be done with very cheap servers

No argument here, though the goal was to show people how to use Elastic Transcoder for 3 reasons:

  • Good for the study of certifications (that's our thing)
  • Not many talks on Elastic Transcoder out there so sharing is caring
  • The cost of a developer can outweight a managed service

Destroyed lol!

Sorry buddy, don't mean to tear you down but you're not giving us the benifit of the doubt here.


Thanks for this video Andrew. I have one question about this setup. It sounds like you have 1 s3 bucket for all videos and customers either have access or they don't. What happens in a scenario where you had multiple videos courses and customers could purchase individual courses. Would this setup work for that scenario as well and if so any documentation anywhere that could help me with that? Thanks again for the awesome explanation!


The use-case you're describing is what we didn't cover in the talk due to time constraist. It was something we did have to solve.

CloudFront has a feature called Lambda@Edge which allows all incoming requests to pass through a Lambda function. So when a user requests to view content via our Rails app we generate out our own access token that uniquely identifies that user. We then pass than token along with the request to CloudFront, we ensure that we whitelist that header in the behaviours. We than use that token to validate that user against our database with that custom lambda function.

A single bucket solutions works great because its all our own content for a single platform. If lets say we had whitelabeled our LMS so multiple clients used it we could still use one bucket and lock down subdirectories to specific clients.


I need to make a youtube-like video player for user uploaded videos on my website, could you point me in the right direction? I'm willing to pay for courses, tutorials, etc. Specially if there's written material since I'm currently having bandwith issues. Currently using AWS and RoR


Hi everybody!

I have a problem wih CF.

The transcoded files are stored in a private s3 bucket and He use CloudFront to distribute these files by sgned urls.
All work like charm when it not a video distribution.

I can read image file, html file except video streaming.

The first request to myplaylist.m3u8 it ok with 200 status code but the second file return 403 status code and try to get this second file again and again.


I think this is an issue with the DEV.to player. I'll log a ticket. I have this also on YouTube so here you go bud:



Hey Patrice, what OS and Browser are you using?

You did hurt my feelings. I just want to share my AWS knowledge.

I have to agree with OrlandoCo, not because I want to hurt your feelings, but because they have very valid point.

I was very excited to try and get into the world of AWS/Azure and get in on the buzz on functions and next-gen cloud design choices. In the end, I was horrified at the price of bandwidth. Storage is cheap, but it's expensive to get it out of their datacentres.

Being a hobbyist programmer and filmographer, I need a plcae to host my films. They're 1-3 GB each. I calculated that every time some downloads this film from a cloud provider, it will cost me 10-30 cents.

Now, put this into perspective with a VPS company such as Hetzner who give you a free 20TB of traffic a month, with a surcharge of 1 euro per TB, while giving you a production ready server, SDDs and all for two euros a month.

No brainer. I would rather set up a Linux VPS, Postgres database, Node.js installation, nginx than to create a conceptually sound API that costs me high heaven. From what I've heard, many companies end up returning back to in-house hosting after seeing the bill, but it's a very controversial topic.

I feel that cloud services are a bit like React, striving for design perfection, but impractical in the end (animation libraries have to hack past React to get any decent performance).

This is just my two cents.

Great video though.

EDIT: And while CDNs help take off the load, they also cost something. Cloudfront offers 50GB, and then $0.085 per GB. Practically the same pricing as normal data-out pricing.


The video file cannot be played. The idea looks interesting & convincing but the price per servers is going to be so expensive that you will end up using other streaming services instead of creating one.