无服务器+ aws lambda失败了'将CloudFormation文件上传到S3'

时间:2018-01-24 01:14:22

标签: aws-lambda serverless

我有一个通过serverless deploy部署的lambda,它在

处失败
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...

  Serverless Error ---------------------------------------

  Access Denied

我的公司对S3有非常严格的限制。我怎么知道哪个S3存储桶被拒绝访问,所以我请求访问? serverless.yml看起来像这样:

service: some-lambda-name

provider:
  name: aws
  runtime: python3.6
  stage: 'staging'
  region: us-east-1
  role: arn:aws:iam::12345:role/some-lambda
  memorySize: 512
  deploymentBucket:
    name: lambda-bucket-staging

functions:
  some-lambda-name:
    name: some-lambda-name
    handler: some-lambda-name.lambda_handler
    memorySize: 128

编辑:

在terraform中我的部署角色对我期望部署到的存储桶的总访问权限:

{
  "Action": "s3:*",
  "Effect": "Allow",
  "Resource": [
    "arn:aws:s3:::lambda-bucket-staging",
    "arn:aws:s3:::lambda-bucket-staging/*"
  ]
}

1 个答案:

答案 0 :(得分:0)

确保正确设置了操作资源,并且aws资源具有公共访问权限等。

例如,这里是允许访问人力资源帐户存储桶的权限;通知资源不尽相同!

JSON动作资源示例:

img