我使用 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)还不够?
谢谢!