AWS S3 Bucket Folder Access

0

I have created a S3 buckets with the following folders  website  personal. I have hosted a static website under the website folder and made it public with ACL. I was supposed to keep some files in personal folder and restrict the access to one of my friend. Kindly hep me out on how to proceed. I tried granting access using his canonical id, but failed. Please help me out on all possible solution to this issue.

1 Answer
0

When ACLs are disabled then use bucket policies to control access. Grant folder level access through s3 resource policy, follow this re:Post thread. But, based on what you described, it seems that you don't want to go this route.

But here in your case, I assume, you'd have already bucket ACL enabled and object ownership would be either Bucket owner or object writer. Granting objects through ACL, you'd need to add canonical id to each object in that folder.

If your bucket uses the bucket owner enforced setting for S3 Object Ownership, you must use policies to grant access to your bucket and the objects in it. With the bucket owner enforced setting enabled, requests to set access control lists (ACLs) or update ACLs fail and return the AccessControlListNotSupported error code. Requests to read ACLs are still supported. Refer Access control list overview

Once you add canonical id to object, that user should be able to access that object using the following command:

  aws s3api get-object --bucket <bucket_name> --key <directory/file_name> --profile <cli_profile> outfile

Hope you find this information helpful.

Comment here if you have additional questions, happy to help.

Abhishek

profile pictureAWS
EXPERT
answered 9 months ago
  • Do you have additional questions, happy to help.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions