Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you let only authorized user have access contents stored in Amazon's S3?

Once you stored contents in S3 and make it public, then everyone have access to it. Is there a way to let only authorized users have access to the content stored in S3? For example, I have a site that let people store their documents. The server stores these documents in S3 and I would like only the user who uploaded the document to have access to it.

I know I can copy the S3 contents to my server and let only authorized users have access, but this will make the server slow. I would like to be able server the contents directly to the client's browser from the S3.

Thanks.

like image 649
John M. Avatar asked Mar 24 '10 20:03

John M.


People also ask

How do I restrict Amazon S3 bucket access to a specific IAM user?

You can use the NotPrincipal element of an IAM or S3 bucket policy to limit resource access to a specific set of users. This element allows you to block all users who are not defined in its value array, even if they have an Allow in their own IAM user policies.

Which of the below allows you to restrict access to individual objects in an S3 bucket?

Amazon S3 is the only object storage service that allows you to block public access to all of your objects at the bucket or the account level, now and in the future by using S3 Block Public Access. To ensure that public access to all your S3 buckets and objects is blocked, turn on block all public access.


2 Answers

The link given in the above answer is no longer correct -- Amazon had it's documentation reorganized. I think these are the correct pages to read:

  • http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/index.html?RESTAuthentication.html#RESTAuthenticationQueryStringAuth
  • http://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html
like image 77
Ivan Kurmanov Avatar answered Sep 20 '22 11:09

Ivan Kurmanov


You want to read the section called 'Query String Request Authentication Alternative' found here

It explains how to create a time-based expiring link to an S3 object

You would then have to write the code that manages the users (the who owns which object part of your question).

like image 31
Joshua Smith Avatar answered Sep 20 '22 11:09

Joshua Smith