Featured Image
  • Overview

    Learn how Amazon S3, a core AWS storage service, can be used to host video resources for streaming services, along with different storage classes offered by Amazon S3.

  • Scope

    This blog covers the basics of Amazon S3, its storage architecture, eight different storage classes, and how to store and make small videos accessible using S3. It also explains how to restrict access to subscription-based videos using pre-signed URLs with time limits.

Applications that use a lot of bandwidth, like video streaming services, are a strong candidate for hosting in the cloud. The majority of people immediately think of Amazon Web Services (AWS) whenever the notion of cloud computing is referenced. Now that we have that out of the way, let's take a look at how easily a core AWS storage service can be included into the backend of streaming services.

What is Amazon S3?

According to our friends at Wikipedia, “Amazon S3 or Amazon Simple Storage Service is a service offered by Amazon Web Services (AWS) that provides object storage through a web service interface. Amazon S3 uses the same scalable storage infrastructure that Amazon.com uses to run its e-commerce network. Amazon S3 can store any type of object, which allows uses like storage for Internet applications, backups, disaster recovery, data archives, data lakes for analytics, and hybrid cloud storage.”

Amazon S3 uses an object storage architecture to store its customers' data. This design strives to provide scalability, high availability, and low latency in conjunction with high durability.,p> The most fundamental units of storage in Amazon S3 are called buckets.

The Amazon S3 service offers eight distinct storage classes that can be selected by the customer depending on their needs. Every storage class comes with its own collection of features, capabilities, and use cases to choose from. The Amazon S3 Standard is the storage class that is used by default which is for data that is accessed often.

Note: The size of an S3 object might range anywhere from one byte up to five terabytes. Any file that is larger than 5 terabytes (TB) need to be divided into many sections before it can be uploaded. Amazon S3 allows for a maximum of 5 GB to be uploaded within a single operation; anything that is more than 5 GB has to be uploaded through the S3 multipart upload API.

Now, as we have covered some ground, let’s jump into the specifics.

Will it stream if we first make a video resource stored on Amazon S3 publicly available and then encapsulate the resource's URL within an HTML5 video element? Is it really that straightforward?

The answer is affirmative. We can create a bucket, upload the file and keep the permissions to allow all users across the internet. We can do it either using the AWS console or the AWS SDK. We can use the URL provided by AWS for this object and encode it in our application. As simple as that. We do not need to make use of any extra services such as Amazon CloudFront which pops up in the search results for the same query on Google.

<video id="clip"     controls preload=auto     width=1920 height=1080    data-setup="{}">
    <source src=https://s3.amazonaws.com/<bucketname><file>.mp4   type='video/mp4'/>        
</video> 

Note: We can also configure RTMP on Amazon S3 so that the users can skip to a certain part of the video buffer it buffers to that point. Pretty neat? Definitely.

Consequently, there’s a catch. This can only be used for the small videos which can be accessed freely, such as trailers or teasers of the movies of shows. We are looking for a solution for video streaming service such as a whole movie or show which is going to be subscription based. How exactly should this be put into action?

We have the ability to adjust the authorization in order to restrict public access. Because of this, the file will be inaccessible to anybody and everyone on the internet. This is not what any of us wants. For a predetermined length of time, we only want certain users to be allowed to access the things in question. Creating a token for each of the items would be the optimal answer to this problem, which has to be addressed. Any person who possesses the token will have access to the object. When the subscription is no longer active, how can we restrict access? We set the time limit for validity. The solution that we are searching for involves pre-signing the URL of the S3 item. The Amazon Web Services (AWS) authentication mechanism enables the generation of authorised URLs that are valid for a certain amount of time.

Steps

1. Create a bucket. Bucket name has to be globally unique

 

image

2. Upload an object to the bucket

 

image

Optional: Verify the object access

 

image

3. Copy the “S3 URI” not “URL” of the object

 

image

 

4. Open the terminal or command prompt as per the operating system being used

Note: AWS SDK must be installed, and the user must be logged into the AWS account.

aws s3 presign   --region ap-south-1   --expires-in 300

This command gives a unique URL.

image

In the URL we get get “Amz-Credential=” which is the most important part of it. We also get “Amz-Date= which gives the time stamp and “Amz-Expires=” which defines the expiry time. So, without public access anyone having the unique pre-signed URL can access the object.

Conclusion

We may make use of fundamental yet powerful technologies such as Amazon Web Services' S3 in order to simplify the development process. This will allow us to concentrate more on the product and less on the establishment of intricate delivery processes, which put strain on the development team and increase overhead costs.

S3 Power Unleashed

WANT TO UNLOCK THE
POTENTIAL OF AWS S3?

Let us help you unlock the hidden potential of AWS S3 for seamless online streaming

TALK TO US