How (and Why) to use Amazon S3 to Deliver Audio, Video and PDF on your WordPress website - S3 Media Vault - WordPress Plugin for Amazon S3 and CloudFront That Provides a S3 Audio Player and a S3 Video Player

How (and Why) to use Amazon S3 to Deliver Audio, Video and PDF on your WordPress website

By Ravi Jayagopal | S3MediaVault

Feb 06

"I want a REFUND!! Your course videos are not loading and your download links are all broken!!!"

"Your videos are loading really slow - unable to watch them!"
"I'm not able to access the course I just bought from you!"
"Your videos are not playing for me at all!"
"Can I get a refund? I can't download anything from your membership site!"
"I'm not able to log in to your website!"
"Your podcast is not downloading!"

"Unable to play the audio files in the member's area!"

Sound familiar? If it does, then I have great news for you, because I'll show you why it's happening and how to make sure it doesn't happen again.

And if it doesn't sound familiar and you haven't had your members say those things to you (yet), then I have even better news for you, because in this article, I'll show you how to make sure it never happens to your members - not even once.

You've Got Content!

If you are have a self-hosted WordPress website, and you have a membership site or online course, then you're probably creating a bunch of Audio, Video, PDF, Zip, Doc, etc.

  • Online course videos​
  • Content Marketing videos​
  • How-to videos
  • Documentation videos​
  • Audiograms (a static image with a moving audio waveform over it to show that it's an audio clip)​
  • Podcast episodes
  • Audio-book chapters​
  • Audio courses​
  • Bonus audio and video lessons 
  • Mini-courses
  • Mindmaps, PDF reports, eBooks, Kindle Books, Word Docs
  • Zip files, Images, Specialized files (like Photoshop files, Mobile app files, Code, etc)

And you need a place to securely store them so that only authorized and paying members can access them.

And you need a a way to securely deliver them to your visitors, subscribers or members such that they can conveniently consume your content - for eg., Your members should be able to watch videos and listen to audios right from a page on your website, and they should also be download them if they wish to, including PDF files and other files - ONLY if you want them, of course. And you should have that choice.

"What's the big deal", you ask? Why can't you just upload these files to your website via FTP or through the WordPress Media page and just store them on your own website? After all, you have "Unlimited Hosting" and "Unlimited Bandwidth" from your web host, so why not take advantage of it, right? That's a great question asked by a lot of WordPress users. And here's 
why.

Storing Video & Audio On Your Website (Hint: Don’t!)

Regular web hosts (think Godaddy, Dreamhost, Hostgator, etc - which are terrible web hosts, by the way - I highly recommend SiteGround and LiquidWeb) are not suited for media hosting, not even if you have a VPS or Dedicated Server.

If you’re an Online Course Creator and you have Audio, Video and PDF and other files (like mindmaps, powerpoints, docs, zips, etc) in your courses, and you release a new course, or do a launch, then when a (even reasonably) large number of your members - like under 50, for eg., - try to access your online course and download those files, that means potentially hundreds (or thousands) of requests to your video, audio and PDF.

And that could cause a big spike in server utilization on your web host. Don't forget - when a file is downloaded from your website, it's not just your server's "bandwidth" that is being used. Your server has to allocate server resources to stay connected with that person downloading the file, and has to make sure the file gets delivered fully. And that's even without any kind of security on the file. 

So if you try to protect the file with some kind of a plain PHP script, now that means any request to the file is intercepted by your PHP download protector script, and that script has to to be running the entire time that the file is being downloaded. That's not a big deal for smaller files, but when it comes to audio, or more specifically video, we're talking about potentially tens or hundreds of MB's in file size. And that's just for one file. If you have an online course, then you now have tens of such videos, audio and PDF. Then add tens of different members who bought your online course trying to access them at- or around the same time. 

All of this could cause a massive spike in your actual server resources - like memory, number of concurrent PHP threads running, etc. So long technical story short, that kind of load increase on your website could cause problems for your members: Website being too slow, errors when trying to log in and navigate through your membership site, videos and audio loading very slowly (or not at all), your website crashing and your members can’t even get to your member’s area, etc.

And this doesn't apply only to online course creators - if you’re a podcaster and host your MP3 files on your own server, then you'll have the same issue as well. When you release a new episode, your RSS feed could get hundreds (or hopefully thousands) of requests, and that will in turn download hundreds (or thousands) of copies of your MP3 file. And that can put a great strain on your web host.

Content Delivery Networks - aka CDN’s - like Amazon CloudFront and CloudFlare were created exactly for this reason – because regular web hosts cannot handle massive amounts of media downloads, especially if they happen concurrently, and all website owners need a fast, secure, reliable, and scalable location where they can store their media files.

So for various technical and logical reasons, it’s never a good idea to host your own media files – Audio, Video or PDF (zip,doc,etc) – on your own web site.

If you're an online course creator or just sell digital information products using WordPress, store all of your premium Video, Audio and PDF on the super-fast and powerful media hosting service Amazon S3 - a part of Amazon Web Services (AWS) - easily the biggest and most powerful Cloud Platform, running on Amazon's powerful servers all around the world (more detailed explanation below).

Then use a plugin like S3MediaVault.com to securely embed your premium content from Amazon S3 directly into your website and make it available only from your website.

Then add AWS CloudFront (a layer on to of S3, explained further in this article) to it to deliver that content blazing-fast speeds.

So if S3 can be compared to express overnight shipping, adding CloudFront is like 2-hour delivery. Zippity zappity boom!

Podcasters: Use a regular podcast host like Libsyn (what I use and recommend; coupon code subscribeme gets you up to 2 months free) , BluBrry or PodBean. Or if you must host your own RSS feed, you can do that with PowerPress, but don't host the actual files on your own server. Use a quality podcast host for that. And DO NOT use Google Drive or Dropbox or some free hosting site for this. It's against the TOS of many of those services, plus free hosts can disappear overnight, and they're still not optimized for audio delivery for podcasts.

What is Amazon S3?

To oversimplify it, Amazon S3 is basically a "hard-disk in the cloud" to store all kinds of files and other data from (and for) your website.

Think of it like Google Drive or Dropbox, except way more powerful - and useful for businesses looking to store data in the cloud and then access and manipulate that data across different websites and servers and systems. It lets you do a lot of really cool stuff with the data you store there. 

But this is not an article for developers. There is a ton of technical documentation for that. 

This article is more about how and why it's relevant and useful for you - if you're a blogger, entrepreneur, digital marketer, content creator, podcaster, course creator, eBook author, Audiobook creator, etc - and you create digital content as part of your free content marketing, for your lead-magnets (email bribe), bonus content as well as paid content for your patrons, subscribers, and members of your membership site or online course.

This article is not about helping you write a plugin or software using S3, but to help you understand - as a digital creator - how (and why) to use S3 to store and securely deliver the content that you're creating, from S3 into your own WordPress website.

In an earlier section, I wrote about why you should not store your video, audio, pdf, zip, doc and other files on your own web host. Now the next question is, if you store all of your files on S3, then you'll have a whole new set of questions and challenges, like...

  • How do you link to your audio, video and PDF stored on S3, from your WordPress site?
  • Do you simply copy the links to your files from Amazon S3 and publish them on your pages?
  • How do you embed your content in your website?
  • What about link security? You don't want them to be public.
  • You don't want them to accessible (clickable) outside of your website
  • You want the links to expire quickly (you should be able to configure that), so that it's not shareable outside of your website to unauthorized users.
  • And you don't want to simply publish all media files as a plain link.
  • You want a video files from Amazon S3 to turn into a video player on your pages.
  • You want your audio files in your Amazon S3 account to turn into an actual, playable audio player on your website.
  • You want PDF, Doc, Zip and other files to show up as secure, clickable, expiring links on your pages.
  • You want to be able to combine multiple videos into a Video Playlist, and multiple audio files into an Audio Playlist
  • You want the players to have all the regular features - like ability to speed-up playback, fast-forward, rewind, a download link to the file in case they wish to store it offline (and only if you wish to allow them to download it)
  • You want to easily get the Transcriptions of your Audio and Video files
  • You want to not just securely deliver "progressive download" videos, but you may also want to deliver them as "streaming" videos (for whatever reason) - which means, the viewer cannot download the videos even if they wanted to.

And that's where a plugin like S3MediaVault.com becomes a critical part of your toolbox as an entrepreneur and digital creator.

How can Amazon S3 protect my private content and deliver it only to authorized users?

Here's the basic idea behind how this works:

  • If you upload a video to Amazon S3, your "bucket" (folder) is private. by default the video will also be private.
  • However, if your bucket is public, then any content you upload to that bucket will also be public by default. And if you simply take the link that S3 gives you, and insert it into WordPress, then that link is public. Which means anyone who visits that page, can not only access that link, but also share that link with anyone else, anywhere on the web - like send it to others in an email, post it on social media, or in a forum or Facebook group.
  • And your public link will also be hit by search engine spiders and other web bots, thus not only artificially inflating the number of times the links are accessed, but also increasing your S3 bill substantially for no good reason (it's not like any real- or authorized people are accessing it).
  • So, instead of making your bucket and your links "public", you mark both as "private", and by default, only the AWS account that you use to log in to upload your files will have access to it.
  • Now use a plugin like S3MediaVault and give it the S3 credentials (public and private keys - basically like passwords), and then that will allow S3MediaVault to contact Amazon S3's secure servers and get a real-time, secure, expiring link for each of your media files. And all of that happens at the time of the page loading - so no one will even see any of it happening, as it's all happening in the background as the page loads.
  • So say you have a PDF, 2 Audio files and 3 videos in your S3 bucket. Now you can embed any combination of those files on your page using S3MediaVault.
  • If you embed a S3MediaVault shortcode for 1 PDF, 2 Audio and 3 Videos on a page, then when the page loads, the visitor will see 1 secure link to a PDF, 2 beautiful Audio players, and 3 Video players on that page.
  • Or you can also choose to combine multiple audios into an Audio Playlist, and multiple videos into a Video Playlist. S3MediaVault supports playlists as well.
  • And then on top of that, you can configure S3MediaVault to add CloudFront, so that your links load even faster regardless of where your users are anywhere in the world.

What is a CDN and why do I need one?

CDN stands for Content Delivery Network. Per Wikipedia:

"A content delivery network or content distribution network (CDN) is a geographically distributed network of proxy servers and their data centers. The goal is to provide high availability and high performance by distributing the service spatially relative to end-users. CDNs came into existence in the late 1990s as a means for alleviating the performance bottlenecks of the Internet, even as the Internet was starting to become a mission-critical medium for people and enterprises. Since then, CDNs have grown to serve a large portion of the Internet content today, including web objects (text, graphics and scripts), downloadable objects (media files, software, documents), applications (e-commerce, portals), live streaming media, on-demand streaming media, and social media sites.

CDNs are a layer in the internet ecosystem. Content owners such as media companies and e-commerce vendors pay CDN operators to deliver their content to their end users. In turn, a CDN pays ISPs, carriers, and network operators for hosting its servers in their data centers.

CDN is an umbrella term spanning different types of content delivery services: video streaming, software downloads, web and mobile content acceleration, licensed/managed CDN, transparent caching, and services to measure CDN performance, load balancing, Multi CDN switching and analytics and cloud intelligence. CDN vendors may cross over into other industries like security, with DDoS protection and web application firewalls (WAF), and WAN optimization."

Some popular CDN's are Amazon CloudFront, CloudFlare, Stackpath (formerly MaxCDN) etc.

See the 2nd image in the next section below comparing the use of S3 by itself, vs.  using S3 paired with a CDN like CloudFront.

Do I need both Amazon S3 and a CDN?

Short answer: No, you don't have to use both. But it is definitely recommended that you use both together for the best scalability and performance.

Amazon S3 by itself - along with a plugin like S3MediaVault - is good enough for data storage and secure delivery for most folks just getting started.

However, S3 + CloudFront together takes the speed of delivery (and other features it enables for you - like ability to do True-Streaming, Transcriptions, etc) to a whole new level for your visitors and users anywhere in the world. And that kind of scalability and performance does become important as your website, grows, along with the number of visitors, free subscribers and paying members.

With S3, you are essentially picking one geographical location - one centralized location, like - where your files are stored, and regardless of where your website visitor is located, the Audio, video, PDF or whatever other files that they're trying to watch/listen/read, is all delivered from that single centralized location.

The above image shows the drop-down of locations that you have to choose from when creating your bucket. So S3 makes you choose that location before you can create a bucket, and only then you can upload files to that bucket.

Here are the list of locations supported by S3:

US East (Ohio)
US East (N. Virginia)
US West (N. California)
US West (Oregon)
Asia Pacific (Hong Kong)
Asia Pacific (Mumbai)
Asia Pacific (Osaka-Local)
Asia Pacific (Seoul)
Asia Pacific (Singapore)
Asia Pacific (Sydney)
Asia Pacific (Tokyo)
Canada (Central)
Europe (Frankfurt)
Europe (Ireland)
Europe (London)
Europe (Paris)
Europe (Stockholm)
Middle East (Bahrain)
South America (São Paulo)

So to begin with, you would create a S3 bucket in the region closest to where most of your audience is. However, with an online business, it is not always easy to predict where your audience is going to come from, let alone predicting where your 1001 true fans are located.

So if your audience is mainly from the United States, then you could safely create your S3 bucket in, say, US East (Ohio). The East coast is generally a bit more preferable, as that's closer to the UK and Europe compared to the West Coast. ​

You would then upload all of your media files - Video, Audio, PDF, Zip, Doc etc - to that bucket. And then when your viewer/subscriber/member tries to watch/listen/access that media file, the closer they are that centralized location (Ohio in this example), the faster the media will load for them in their browser.

And the farther they are from the S3 data center in Ohio in the United States, then the longer (even if just a bit) it will take for the media to load in their browser.

Obviously we're talking about all other things being equal and standardized, like speed of computer, and internet access etc.

But adding CloudFront on top of S3, means that now, every file gets fetched from a data center closest to the visitor’s region. So if they're in the UK, then the data is served to them from the data center closest to them in the UK, even though the source file is in the Ohio data center. And that file is cached in the local "edge" network the very first time, and from that point, all UK visitors will get the file quickly delivered from their nearest edge location.

Here are two images that hopefully explains this better (cave-man quality drawing by yours truly notwithstanding 🙂

The image above on the left shows you how the users from different countries will be accessing your files if you are just using Amazon S3 alone.

And the image on the right shows you how your media is accessed by those same users from those same locations, except, this time you have CloudFront enabled.

So Amazon CloudFront is an additional layer that sits on top of your Amazon S3 bucket, and speeds up the delivery of the media in your S3 bucket. Think of it as adding “Turbo Boost” to your S3 files.

The image on the left above, shows that your Amazon S3 bucket is a single location stored in the cloud, and when visitors to your website from all over the world try to access a video, audio, pdf or other media stored in that S3 bucket, they are still served those files from that one central location. Which means, the farther they are geographically from your S3 bucket, the longer (even if it’s just milliseconds longer) it will take to serve them the file.

But CloudFront has various “edge locations” (those little clouds you see in the image on the right) spread globally. So when a US visitor tries to access, say, a video in your online course, if it’s the first time, then the “edge location” (cloud) closest to that person, will copy that file from your S3 bucket to the local cloud. And from that point onwards, every US person who tries to access that video, will be served that video from the local cloud, and not from the S3 bucket. And because Amazon has these edge locations all over the world, your visitors from all over the world will see that your videos, audio and PDF start loading super-fast, because it’s loading from a local cloud that’s closest to them.

Why not use just a CDN then?

A CDN is basically a cloud "network". So this network still needs the files to be stored somewhere, preferably on a high-availability "hard-disk in the cloud". And that's what S3 is. It stores the files, which are then distributed by the CDN, like CloudFront.

How can I stream Videos FROM my Amazon S3 account TO my website?

S3MediaVault lets you create HLS “True Streaming” videos where the videos are streamed, from Amazon's servers, to the viewer’s browser, in real-time. And to give you a quick peek behind what's involved, creating true-streaming videos involves the use of a secure and scalable "hard disk in the cloud" - aka, Amazon S3. Then you need to convert this "regular" video (explained further below) into a "stream". So a regular mp4 video file is chopped up into smaller "segments" and delivered piece-by-piece, in real-time. And to do this, you need a cloud-based service that will do this "chopping up" - aka Amazon MediaConvert. Then you need to store these segments back in S3, and if you want to be able to scale it, then you need a Content Delivery Network (CDN) - aka Amazon CloudFront.

So you basically need S3, CloudFront and MediaConvert in order to store, create and securely deliver a streaming video. And S3MediaVault.com makes that seamless and the tech seem practically invisible, becasuse you never have to see all the technical stuff happening behind the scenes to tie those 3 AWS services together. For you, it's as simple as selecting a video file from your WordPress Admin panel (the S3MediaVault settings page), click on a link that says "Prepare for Streaming", then S3MediaVault will create a streaming video player for that file. Just embed the code on any page on your WordPress site, and you're done.

What's the difference between "Progressive Downloads" and "Streaming Video" (or Streaming Audio)?

Regular “progressive download” videos are progressively (aka continuously) downloaded to the viewer’s browser first, which is why using plugins like Video Downloader will let you download the video you’re watching.

But progressive downloads can increase the costs for the video service, and here's how: As soon as the viewer hits "Play" on the video, the video starts to download to their computer (in whatever the "temp" folder of the browser is, where it stores all temporary internet files).

Now even if the viewer hit "Pause" right after they hit "Play", the video will still continue to download, until it is fully downloaded. So if it's a big file, then the entire file of tens or hundreds of MB's of data is downloaded to their device first, whether it's their computer or their mobile device. And regardless of whether they end up watching 1 minute of the video, or just a few minutes, or even a fraction of the video, the video was downloaded in full to their device.

That means, the video provider (in this case, you, and your S3 account) ended up delivering the entire video, even though they may or may not watch it, or only watch it partially. So more bandwidth cost for you, the provider.

And for the viewer as well, their internet bandwidth is used to download the full video, even though they may or may not watch it, or only watch it partially. So more bandwidth cost for your viewer as well. And especially more so if they're on a mobile device and are using their data and have a limited data plan.

And that's where "Streaming Video" is much more beneficial to everyone involved - well, almost to everyone involved, which I'll explain in a minute. And that's because with streaming video, the video is delivered as a "watch as you go" stream of data. The video provider - in this case, Amazon MediaConvert - converts the long, single .mp4 file into a number of smaller chunks of file "segments". These have the extension ".ts". And there could be tens or hundreds or thousands of such segments depending on how long the video is.

And those segments are delivered one by one to the viewer's device, as they continue to watch the video. But if the viewer hits Pause on the video player, then the segments will stop being downloaded.

So only the bare-minimum amount of video data is delivered to the viewer, as need, as they continue to watch. And that ends up saving you - the provider - money in terms of bandwidth costs; and also reduces the viewer's data usage as the consumer.

But there are two small downsides to streaming:

1) It costs just a teeny-tiny bit more in terms of your overall AWS bill, because to create a streaming video, you need to use Amazon MediaConvert, a cloud-based service that can take a .mp4 file and convert it into streaming "segments".

2) If a part of your audience is from countries where they have very slow or poor internet access, streaming videos will be almost unwatchable to them, because their internet access will never be fast enough to download the video "segments" fast enough for them to continue watching normally. And that would result in the video freezing up every few minutes while the downloading of the segments catches up to their viewing. But with progressive downloads, those who have poor internet access speeds, will be able to hit Play on the video, then hit Pause, and come back in however long, and the video would continue to download the whole time they're away from their device, because that's what progressively downloading means. But you can't do that with streaming where you can Play, Pause and come back later to a fully downloaded video, because the video doesn't download full with streaming.

So if you want regular "progressive download video", you need just Amazon S3, and you get possibly (slightly) higher bandwidth costs because the video is fully downloaded to the viewer's device regardless of how much of it they watch.

And if you want to do "streaming video", then you'll need S3 + CloudFront + MediaConvert. So the addition of CloudFront and MediaConvert increases your costs slightly, but you could also end up saving a little bit on the bandwidth costs, because only as much of the video is necessary, is delivered to the viewer's device.

But using S3MediaVault, you can create true-streaming videos that cannot be downloaded, because they’re both secure, as well as streamed in segments to the viewer’s browser. Which means plugins like Video Downloader won’t be able to find a single mp4 file to download.

You’ll have to use both S3 and CloudFront together to create this streaming video, and S3MediaVault.com can help you do just that..

S3MediaVault uses Amazon AWS MediaConvert service to create the streaming version of your mp4 and then delivers that to your viewer, and makes it really easy and manage everything from within WordPress without having to log in to AWS or know any of the technical stuff behind creating a streaming video.

Is Amazon S3 a web hosting service? Can I install WordPress itself on Amazon S3?

No, you can't install WordPress on Amazon S3. S3 is not an alternative to using a webhost like SiteGround or LiquidWeb (those are the two I use and recommend, after having tried out a whole bunch of different hosts over the year).

S3 is more like Google Drive or Dropbox (oversimplifying, of course). You need an actual web server, PHP, MySQL, etc in order to run a WordPress website. So you need EC2 web/app servers, AWS Elastic Beanstalk, Amazon Relational Database Service (RDS), etc. It’s technically super intensive. You can see more details here. I would not recommend it unless you’re a super-techie or programmer.

So how can I use S3 for my WordPress Website?

You can use it to "outsource" your media files - basically, use it to host your Video, Audio and PDF files  and then embed them on WordPress Pages and Posts in your WordPress website, using S3MediaVault.com, a WordPress plugin that can protect & securely deliver audio, video, PDF & other files from Amazon S3 to your website.

Follow

About the Author

Ravi Jayagopal is a Business Coach, 6x-Author, Speaker, Podcaster, Entrepreneur, Digital Marketer, WordPress Developer and also an Amateur Ventriloquist :-). Read more about him at https://SubscribeMe.fm/ravi-jayagopal

Leave a Comment:

Leave a Comment: