简体   繁体   中英

How to restrict folders to user

Thanks for previous replies.

Is it possible to restrict the user to view particular folder in a bucket. let us take example, i have a bucket and it contains 2 folder, User A have only privilege to view first folder of the bucket, if he tries to access another folder it has to show access denied. is this possible to do in amazon S3.

You can do this using AWS Identity and Access Management (IAM) . You can use this to create multiple identities and assign various permissions to those identities.

Here's a relevant example taken from the Amazon docs:

Example 1: Allow each user to have a home directory in Amazon S3

In this example, we create a policy that we'll attach to the user named Bob. The policy gives Bob access to the following home directory in Amazon S3: my_corporate_bucket/home/bob. Bob is allowed to access only the specific Amazon S3 actions shown in the policy, and only with the objects in his home directory.

{
   "Statement":[{
      "Effect":"Allow",
      "Action":["s3:PutObject","s3:GetObject","s3:GetObjectVersion",
      "s3:DeleteObject","s3:DeleteObjectVersion"],
      "Resource":"arn:aws:s3:::my_corporate_bucket/home/bob/*"
   }
   ]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM