我使用Bref ( https://bref.sh/ )。我尝试使用AWS S3配置serverless.yml文件,以存储 img、css、js 等资产。当我使用“无服务器部署”命令进行部署时,出现此错误:
发生错误:AssetsBucketPolicy - API: s3:PutBucketPolicy 访问被拒绝。
在我的 AWS 账户中,我拥有“AdministratorAccess”权限(https://www.youtube.com/watch?v=KngM5bfpttA&list=PL0_-jlAhLRgEcU0P0Ivi4OO844pgrzJOU&index=2&t=0s)
策略管理员访问
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
}
我的 serverless.yml 文件是:
service: bref-demo-symfony
provider:
name: aws
region: us-east-1
runtime: provided
environment:
# Symfony environment variables
APP_ENV: prod
plugins:
- ./vendor/bref/bref
functions:
website:
handler: public/index.php
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
layers:
- ${bref:layer.php-73-fpm}
events:
- http: 'ANY /'
- http: 'ANY /{proxy+}'
console:
handler: bin/console
timeout: 120 # in seconds
layers:
- ${bref:layer.php-73} # PHP
- ${bref:layer.console} # The "console" layer
resources:
Resources:
# The S3 bucket that stores the assets
Assets:
Type: AWS::S3::Bucket
Properties:
BucketName: my-unique-serverless-assets-bucket
# The policy that makes the bucket publicly readable
AssetsBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref Assets # References the bucket we defined above
PolicyDocument:
Statement:
- Effect: Allow
Principal: '*' # everyone
Action: 's3:GetObject' # to read
Resource: 'arn:aws:s3:::my-unique-serverless-assets-bucket/*' # things in the bucket
在 AWS S3 上,我尝试在存储桶上添加一个策略
{
"Id": "Policy1573043469280",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1573043465451",
"Action": "s3:*",
"Effect": "Allow",
"Resource": "arn:aws:s3:::bref-demo-symfony-dev-serverless-assets/assets",
"Principal": "*"
}
]
}
我有一条消息,例如“拒绝访问”、“您无法授予公共访问权限,因为此帐户的阻止公共访问设置已打开。要确定哪些设置已打开,请检查您的阻止公共访问设置。” 为什么 ?
没看懂怎么配置?这个权限(AdministratorAccess)还不够?
谢谢!