How to restrict folders to user - amazon-web-services

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/*"
}
]
}

Related

How do I let a user see a single bucket in the root s3 console?

What permissions do I set in a policy to allow a user to see a single bucket in the root s3 page in the console (https://s3.console.aws.amazon.com/s3/buckets)
I keep trying different things but either they see all the bucketsor none of them. I gave them permissions to manage the bucket and if they put the bucket url into their browser they can access it fine and upload stuff. But if they go to the root s3 page it doesn't list any buckets.
It is not possible to control which buckets a user can see listed in the S3 Management Console.
If a user has permission to use the ListBuckets() command, then they will be able to see a listing of ALL buckets in that AWS Account.
However, there is a cheat...
You can give permissions to a user to 'use' a specific Amazon S3 bucket (eg GetObject, PutObject, ListObjects), while not giving them permission List the buckets. They will not be able to use the S3 Management Console to navigate to the bucket, but you can give them a URL that will take them directly to the bucket in the console, eg:
https://s3.console.aws.amazon.com/s3/buckets/BUCKET-NAME
This will let them see and use the bucket in the S3 Management Console, but they won't be able to see the names of any other buckets and they won't be able to navigate to their bucket via the 'root s3 page' that you mention. Instead, they will need to use that URL.

How to restrict S3 access to users of Active Directory

Need to create S3 bucket and few objects which are intranet facing. But users may not be having AWS access.
How to restrict S3 access to users of my companies Active Directory.
You need to do two things,
Connective Active Directory to AWS IAM
Create Roles for users to whichever the way you want it to S3
AD to IAM:
https://aws.amazon.com/blogs/security/how-to-connect-your-on-premises-active-directory-to-aws-using-ad-connector/
S3 IAM Role based Access:
https://aws.amazon.com/blogs/security/writing-iam-policies-grant-access-to-user-specific-folders-in-an-amazon-s3-bucket/
Hope it helps.

How to see policies for S3 buckets which showing `Access Denied` error in AWS Console?

I've logged into AWS account as root user. But I'm unable to access some of the buckets in AWS. They are not showing in the S3 Console. I've accessed them by submitting the bucket name in the url
For example let's call the bucket unaccessible-bucket
https://s3.console.aws.amazon.com/s3/buckets/unaccessible-bucket/?region=us-east-1&tab=overview
If I navigates to Permissions > Bucket Policy I'm seeing notice Access denied, I'm unable to download the files. I'm unable to change the policy. I've tried with AWS CLI also.
Can someone please tell me how to edit the policy.
As per our organisation requirement,
We have to add two new IAM users..
For one user...We have to grant access to all buckets including this unaccessible-bucket.
For other user...We have to grant access to only this unaccessible-bucket.
Please check the screenshot
Many Thanks.
Assuming that you are logged into the AWS Console as the root user.
If you cannot see an S3 bucket in the AWS console, then you do not own the bucket and it is owned by another account.
If you can see the bucket in the console then you own the bucket. If you cannot access the contents of the bucket then you will need to edit the S3 Bucket Policy and add the root user as a principal. Replace the account number with your own.
Add this statement (or modify) to your S3 Bucket Policy:
"Principal": { "AWS": "arn:aws:iam::123456789012:root" }

AWS user can access stuff I didn't grant them access to

I created an AWS user and granted them access to just a few things as you can see on this screenshot:
And then they logged in and told me they can access my S3 and a few other services. I even had them test uploading a file to my S3.
So what did I do wrong?
Thanks.
Look at the policy for AWSLambdaFullAccess. Under "Action" you will see "s3:". This gives the user full access to all S3 commands. Under "Resource" you will see "". This give the user full access to all resources (in this case all S3 commands on all S3 resources).

AWS S3 bucket folder tagging for user access

I am setting up personal folders for all the employees. We have about 300 employees. Each will have its own S3 folder. Is it possible to tag each folder in the S3 bucket to control user access?
An S3 folder is basically an object. You can add an IAM policy to control user access to each object (or folder). In your case, adding 300 policies is not feasible. So, you could use "policy variables" that enable you to add a single policy that works for all users (depending on the user name) as explained in the following blog post:
Writing IAM Policies: Grant Access to User-Specific Folders in an Amazon S3 Bucket