我正在尝试将构建文件从Jenkins上传到S3 Bucket。我只想要Cloudfront&用户deployer
有权访问存储桶,策略如下:
{
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity XXXXXXXXXX"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::samplebucket/*"
},
{
"Sid": "2",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::1234567890:user/deployer"
]
},
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::samplebucket",
"arn:aws:s3:::samplebucket/*"
]
}
]
}
此政策不允许deployer
将对象上传到S3。然而,如果我将存储桶访问设置为公共,我能够成功上传Jenkins中的对象。我不希望我的桶被公开。