Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 为什么我’;当我试图用“PutObject”权限上传到我的S3存储桶时,我得到了一个“AccessDenied”?_Amazon Web Services_Amazon S3_Amazon Iam_Serverless Framework - Fatal编程技术网

Amazon web services 为什么我’;当我试图用“PutObject”权限上传到我的S3存储桶时,我得到了一个“AccessDenied”?

Amazon web services 为什么我’;当我试图用“PutObject”权限上传到我的S3存储桶时,我得到了一个“AccessDenied”?,amazon-web-services,amazon-s3,amazon-iam,serverless-framework,Amazon Web Services,Amazon S3,Amazon Iam,Serverless Framework,你知道为什么我在尝试上传到S3存储桶时遇到AccessDenied错误吗 serverless.yml: service: foo-service custom: bucket: my-bucket-name provider: name: aws iamRoleStatements: - Effect: Allow Action: - s3:PutObject Resource: "arn:aws:s3:::${self:cust

你知道为什么我在尝试上传到S3存储桶时遇到
AccessDenied
错误吗

serverless.yml

service: foo-service

custom:
  bucket: my-bucket-name

provider:
  name: aws
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:PutObject
      Resource: "arn:aws:s3:::${self:custom.bucket}/*"

functions:
  hello:
    handler: handler.hello
    environment:
      BUCKET: ${self:custom.bucket}

我正在尝试向S3添加一个具有
public read
权限的文件。

S3:PutObject
权限就允许您向S3存储桶添加一个项目,但如果配置任何ACL属性,则需要额外的权限
S3:PutObjectAcl

应该是这样的:

provider:
  name: aws
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:PutObject
        - s3:PutObjectAcl
      Resource: "arn:aws:s3:::${self:custom.bucket}/*"