pancho
pancho

Reputation: 186

Restrict user access to Single S3 Bucket using Amazon IAM?

When you work with the team, you might want to restrict an access to a single S3 bucket to specific users. How can I achieve this?

The following code is not working. The user still has full permission.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "s3:ListAllMyBuckets",
            "Resource": "arn:aws:s3:::*"
        },
        {
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::Privatebacket",
                "arn:aws:s3:::Privatebacket/*"
            ]
        }
    ]
}

Upvotes: 2

Views: 1272

Answers (3)

Subhash
Subhash

Reputation: 762

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                        "s3:GetBucketLocation",
                        "s3:ListAllMyBuckets"
                      ],
            "Resource": "arn:aws:s3:::*"
        },
        {
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::YOUR-BUCKET",
                "arn:aws:s3:::YOUR-BUCKET/*"
            ]
        }
    ]
}

https://www.serverkaka.com/2018/05/grant-access-to-only-one-s3-bucket-to-aws-user.html

Upvotes: 2

Manoj
Manoj

Reputation: 2434

You can add an inline policy for that IAM user. You can set a 'deny' policy to that specific s3 bucket.enter image description here

enter image description here

Policy Document:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "Stmt1497522841000",
        "Effect": "Deny",
        "Action": [
            "s3:*"
        ],
        "Resource": [
            "arn:aws:s3:::mjzone-private"
        ]
    }
]
}

Upvotes: 0

arun thatham
arun thatham

Reputation: 500

Try the below mentioned link. You can grant user specific folder permissions using IAM policies.

https://aws.amazon.com/blogs/security/writing-iam-policies-grant-access-to-user-specific-folders-in-an-amazon-s3-bucket/

Upvotes: 0

Related Questions