Is there an S3 policy for limiting access to only see/access one bucket?

前端 未结 23 752
孤城傲影
孤城傲影 2020-11-29 15:08

I have a simple bucket that looks like images.mysite.com on my S3 and other buckets containing backups, etc.

I want to allow a specific user to be able

23条回答
  •  北海茫月
    2020-11-29 15:46

    It is not possible to provide access to the S3 Console without granting the ListAllMyBuckets permission.

    In my case (and perhaps yours as well, future reader) an acceptable alternative is to redirect users on sign in directly to the bucket you would like them to see.

    To accomplish this, append the following to your IAM sign in url: /s3/?bucket=bucket-name

    Full Sign-in URL (replace your-alias and bucket-name):

    https://your-alias.signin.aws.amazon.com/console/s3/?bucket=bucket-name

    IAM Policy (replace bucket-name):

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

    For more information on how to create bucket specific permissions for users, read this blog: http://mikeferrier.com/2011/10/27/granting-access-to-a-single-s3-bucket-using-amazon-iam/

提交回复
热议问题