问题描述
我希望使用ACL作为资源,并根据需要将资源引用到任何存储桶。
下面的代码片段将使用无服务器框架和无服务器部署桶插件将策略应用于部署存储桶。
...............
custom:
deploymentBucket:
versioning: true
policy:
{
"Version": "2012-10-17","Statement": [
{
"Effect": "Deny","Principal": "*","Action": "s3:*","Resource": [
"arn:aws:s3:::bucket-name","arn:aws:s3:::bucket-name/*"
],"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}
]
}
provider:
region: eu-west-2
name: aws
runtime: nodejs12.x
deploymentBucket:
name: bucket-name
serverSideEncryption: AES256
resources:
- ${file(resources/deployment-bucket.yml)}
................
deployment-bucket.yml中的代码如下:
Resources:
ServerlessDeploymentBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref ServerlessDeploymentBucketName -> this is the Identifier,taken from the CF template bundled by serverless framework.
AccessControl: Private
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: aws:kms
错误发生错误:ServerlessDeploymentBucket-存储桶名称已存在。
该错误非常具有描述性,因此我认为我需要找到一种将ACL资源应用于存储桶的方法。 我已经尝试过并删除BucketName键。 没有成功。
SourceArn:
!Sub
- 'arn:aws:s3:::${Bucket}/*'
- { Bucket: Ref ServerlessDeploymentBucketName }
更新
这应该可以解决ACL问题
https://www.serverless.com/plugins/serverless-default-aws-resource-properties
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)