彭煥閎
彭煥閎

Reputation: 107

How can I limit the access count of a S3 video?

I have some home videos put on AWS S3, I want to limit each video's access count.

The scenario is a little like we access Netflix, if I have a four user account, then I can at most 4 users steaming video concurrently, when the 5th user try to streaming a new video, he will get error.

But my case is I want the limitation is file(each file url) base. Each video file can be played by 5 users concurrently. The 6th user will get error if he try to streaming this video until at least one of the previous 5 users stop streaming that file.

Is there any way to achieve my goal?

Should I write something to do this limitation or it just a setting inside the S3 service?

Thank you~~

Eric

Upvotes: 0

Views: 556

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269390

There is no such setting in Amazon S3.

By default, objects in Amazon S3 are private.

If you wish to keep objects private but grant access to them (eg for playing a video), your application can generate a Pre-Signed URL. This URL grants temporary, time-limited access to an object.

For example, if a user requests permission to play a video, your application can generate a pre-signed URL. The user can then use this URL to access the video. Once the expiry time passes, the URL no longer works.

However, there is no ability to limit the number of "concurrent accesses" of objects in Amazon S3. If you wish to do this, then you will need to stream the content from your application, which would be responsible for imposing such restrictions.

Upvotes: 1

Related Questions