aldy120 / s3-note

Note for Amazon S3
0 stars 0 forks source link

Access for certain bucket #31

Open aldy120 opened 1 year ago

aldy120 commented 1 year ago

Grant access to some bucket only. The policy can be attached to an IAM entity (user/role/group).

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::<BUCKET1>",
                "arn:aws:s3:::<BUCKET2>"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::<BUCKET1>/*",
                "arn:aws:s3:::<BUCKET2>/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListAllMyBuckets",
                "s3:GetBucketLocation",
                "s3:GetAccountPublicAccessBlock",
                "s3:GetBucketPublicAccessBlock",
                "s3:GetBucketPolicyStatus",
                "s3:GetBucketAcl",
                "s3:ListAccessPoints"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

To show Access field in S3 console list buckets page, we need to add some additional permissions. https://aws.amazon.com/premiumsupport/knowledge-center/s3-console-error-access-field/

ListBuckets cannon do partial list.