Amazon S3: allow single User access to only one Bucket

amazon s3amazon-web-services

Despite my best efforts, even using the official AWS Policy Generator and AWS Policy Simulator, I just cannot get the correct policy or policies to allow a single User access to only one Bucket.

This is what I have generated but when I test, it fails.

{
    "Statement": [
        {
            "Action": [
                "s3:ListAllMyBuckets",
                "s3:GetBucketLocation",
                "s3:ListBucket"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::*"
        },
        {
            "Action": "s3:*",
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::bucket.name/*"
        }
    ]
}

I am trying to apply this policy to the User in IAM.

What am I doing wrong?

Best Answer

That policy works for me. It is likely that you either have a typo in the bucket name, or the policy isn't attached to the user you're using, you're accessing the bucket using a different user than you think you are, etc.