【发布时间】:2017-10-14 06:30:22
【问题描述】:
提前致谢!
我整个周末都被困在这个问题上。我正在尝试在 cloudformation 中创建 cloudtrail 服务,但运行时收到此错误 - 检测到存储桶的 S3 存储桶策略不正确:s3bucket-xxxxxx
这是我的代码;
"s3bucket-xxxxxx": {
"Type": "AWS::S3::Bucket",
"Properties": {
"AccessControl": "Private",
"VersioningConfiguration": {
"Status": "Suspended"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "XXXX"
}
}
},
"s3policytraillogs": {
"Type": "AWS::S3::BucketPolicy",
"Properties": {
"Bucket": {
"Ref": "s3bucket-xxxxxx"
},
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AWSCloudTrailAclCheck20150319",
"Effect": "Allow",
"Principal": {
"Service": "cloudtrail.amazonaws.com"
},
"Action": "s3:GetBucketAcl",
"Resource": "arn:aws:s3:::s3bucket-xxxxxx"
},
{
"Sid": "AWSCloudTrailWrite20150319",
"Effect": "Allow",
"Principal": {
"Service": "cloudtrail.amazonaws.com"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::s3bucket-xxxxxx/AWSLogs/XXXXXXXX/*",
"Condition": {
"StringEquals": {
"s3:x-amz-acl": "bucket-owner-full-control"
}
}
}
]
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "XXXX"
}
}
},
"trailtraillogs": {
"Type": "AWS::CloudTrail::Trail",
"Properties": {
"IncludeGlobalServiceEvents": true,
"IsLogging": "true",
"S3BucketName": {
"Ref": "s3bucket-xxxxxx"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "XXXX"
}
}
}
【问题讨论】:
-
"VersioningConfiguration": { "Status": "Suspended" }的预期用途是什么?似乎不可能创建一个暂停版本控制的存储桶。 -
嗨,Michael,感谢您回复我,这只是 cloudformer 生成的东西,需要不同的值吗?
-
我只是凭直觉操作,那里。存储桶上的版本控制只能在第一次启用后暂停——我想。但实际上,错误是关于政策的,所以我可能误导了你。我将更仔细地检查政策部分。
-
我想知道您是否不需要像第二个语句中的
"Resource": [{ "Fn::Join": [ "", [ "arn:aws:s3:::", { "Ref": "s3bucket-xxxxxx" }, "/AWSLogs/XXXXXXXX/*" ]和类似但在第一个语句中没有最终字符串的东西来构建您的 ARN。恐怕我真的没有看到问题,否则。 -
感谢您的帮助迈克尔!
标签: amazon-web-services amazon-s3 amazon-cloudformation amazon-cloudtrail