私有s3存储桶返回403禁止访问

时间:2020-10-15 05:00:51

标签: amazon-s3

我已将存储桶策略设置为受限。当我托管我的网站时,它正在返回

403 Forbidden Access denied

当我公开发布存储桶政策时,我可以正确托管我的网站。但我希望将存储桶策略设为私有。

怎么办?

{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "ListYourObjects",
        "Effect": "Allow",
        "Principal": {
            "AWS": "arn:aws:iam::254586849558:root"
        },
        "Action": "s3:ListBucket",
        "Resource": "arn:aws:s3:::bucket-name",
        "Condition": {
            "StringLike": {
                "s3:prefix": "cognito/application-name/${cognito-identity.amazonaws.com:sub}"
            }
        }
    },
    {
        "Sid": "ReadWriteDeleteYourObjects",
        "Effect": "Allow",
        "Principal": {
            "AWS": "arn:aws:iam::254586849558:root"
        },
        "Action": [
            "s3:GetObject",
            "s3:PutObject",
            "s3:DeleteObject"
        ],
        "Resource": [
            "arn:aws:s3:::bucket-name/cognito/application-name/${cognito-identity.amazonaws.com:sub}",
            "arn:aws:s3:::bucket-name/cognito/application-name/${cognito-identity.amazonaws.com:sub}/*"
        ]
    }
]

}

0 个答案:

没有答案