1

У меня следующий файл serverless.yml, когда я его развертываю, я разрешаю разрешение на ведро product-image-dev, как мне установить разрешение в iamRoleStatements или его нужно где-то установить остальное.Как добавить разрешение ведра в serverless.yml

service: imagecrops 

provider: 
    name: aws 
    runtime: nodejs4.3 
    memorySize: 1024 
    timeout: 20 
    satege: dev 

    iamRoleStatements: 
     - Effect: "Allow" 
     Action: 
      - "s3:*" 
     Resource: 
      - { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ]]} 


package: 
    include: 
    - bin 
    - libs 
    exclude: 
    - tests 
    - serverless-nodejs-image 

functions: 
    cropImage: 
    handler: handler.cropImage 
    description: Crops images, from S3 bucket and puts into new folder 
    events: 
     - s3: 
      bucket: product-images-dev 
      event: s3:ObjectCreated:* 
      rules: 
      - prefix: uploads/ 

ответ

4

Я поменял файл serverless.yml следующим образом и начал читать.

service: imagecrops 

provider: 
    name: aws 
    runtime: nodejs4.3 
    memorySize: 1024 
    timeout: 20 
    satege: dev 

    iamRoleStatements: 
     - Effect: "Allow" 
     Action: 
      - "s3:*" 
     Resource: 
      - { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ]]} 
      - "arn:aws:s3:::product-images-dev/*" 


package: 
    include: 
    - bin 
    - libs 
    exclude: 
    - tests 
    - serverless-nodejs-image 

functions: 
    cropImage: 
    handler: handler.cropImage 
    description: Crops images, from S3 bucket and puts into new folder 
    events: 
     - s3: 
      bucket: product-images-dev 
      event: s3:ObjectCreated:* 
      rules: 
      - prefix: uploads/