S3 Public & Private Access using the JavaScript SDK

0

Hi!

I'm looking to implement the aws-sdk on my web application with 2 layers of security.

  1. Some images should be publicly accessible (For example company logos). This is to prevent needing to re-authorise images constantly on each page load
  2. Some images should be private and only shown if authorised (e.g more confidential images relating to a company)

Is there a better way for me to do this? If not, with my current setup it appears that even when I set CannedACL to private it always has the object set to public when in S3. I've attached my configuration and usage below, any help would be really appreciated!

Bucket Settings Bucket Policy CORS Config Usage in code

Thanks!

已提问 1 年前635 查看次数
1 回答
0

Option 1: You could do subfolders for the s3 buckets one for the public and one for private and set the bucket policy open for the public and internal for private.

Option 2: You could also use two separate S3 buckets. One for public assets and one for private assets You don't pay by the bucket so no big deal to have two buckets.

Note: It may be better to go with option 2 so you don't accidentally modify the S3 bucket policy to allow access to the private side. I like to separate mine so I can have public access turned off on the private one. Then I provide access to the items in the private bucket with IAM.

Evan
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则