我正在尝试在yaml中创建以下存储桶策略,但是bucketPolicy无法创建:
Cloudformation错误消息:
Invalid policy syntax. (Service: Amazon S3; Status Code: 400; Error Code: MalformedPolicy; Request ID: CD4; S3 Extended Request ID: Noxxxx/sXX=; Proxy: null)
需要执行的存储桶策略:
{
"Version": "2012-10-17",
"Id": "ig",
"Statement": [
{
"Sid": "LZone",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123:role/l-zone"
},
"Action": [
"s3:AbortMultipartUpload",
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject",
"s3:GetObjectVersion",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::bucketname-l/*",
"arn:aws:s3:::bucketname-l"
]
}
]
}
这是上述策略中yaml中的代码(不起作用):
LBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub bucketname-l
LBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref LBucket
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: LZone
Effect: Allow
Action:
- 's3:AbortMultipartUpload'
- 's3:ListBucket'
- 's3:PutObject'
- 's3:GetObject'
- 's3:GetObjectVersion'
- 's3:PutObjectAcl'
Resource:
Fn::Join:
- ""
-
- "arn:aws:s3:::"
-
Ref: "LBucket"
- "/*"
Principal: "AWS: arn:aws:iam::123:role/l-zone"
有人可以帮我解决我所缺少的内容吗?谢谢
答案 0 :(得分:1)
政策应为:
const standardDeviation = (arr, usePopulation = false) => {
const mean = arr.reduce((acc, val) => acc + val, 0) / arr.length;
return Math.sqrt(
arr.reduce((acc, val) => acc.concat((val - mean) ** 2), []).reduce((acc, val) => acc + val, 0) /
(arr.length - (usePopulation ? 0 : 1))
);
};
console.log('STDEV.S =>',
standardDeviation([
10, 2, 38, 23, 38, 23, 21
])
);
console.log('STDEV.P =>',
standardDeviation([
10, 2, 38, 23, 38, 23, 21
], true)
);