gpt4 book ai didi

amazon-web-services - 如何在 serverless.yml 中添加存储桶权限

转载 作者:行者123 更新时间:2023-12-04 08:07:14 25 4
gpt4 key购买 nike

我有以下 serverless.yml 文件,当我部署它时,它给了我对 product-image-dev 存储桶的权限被拒绝,我如何在 iamRoleStatements 中设置权限或者它必须在其他地方设置。

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/

最佳答案

我按如下方式更改了 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/

关于amazon-web-services - 如何在 serverless.yml 中添加存储桶权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41197983/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com