Allow only registered users to download from my Amazon S3 bucket

I am creating a PHP site that will store its content files on Amazon S3. Website files (with PHP code) are hosted on a traditional server. Users will register on the site, and after registration and login, they will have access to files on S3.

The question is how to allow only registered users to upload files and not allow all others to download? Should AWS IAM be involved?

I do not want to expire the URL. I want to grant access to files only to a specific user, and I do not want them to share the link with anyone else for some period of time.

In the future, I also want to limit access to files for registered users - depending on the type of user account, the user will have access to various files.

Thanks in advance for the answers!

+8
php amazon-s3 amazon-web-services
source share
1 answer

This can be done ... I use ROR instead of PHP, where my application controls access to data in an S3 bucket. I have buckets, access to which my application and access to files are limited by their credentials in my application. Make sense?

I have a public bucket for storing my assets (public images) and buckets that only my application can access. My app users can only access certain bucket bits based on their credentials.

The database stores a link to the exact s3 file / location, access to it (encrypted credentials and keys transmitted during the transaction), and who can access it.

Read about serving web resources from an S3 bucket and creating a upload form in an S3 bucket. This will give you an idea of ​​how to interact with S3 buckets. Once you can interact with the contents of the bucket, you can control access to your web application.

Good luck

+3
source share

All Articles