【发布时间】:2021-07-05 12:50:55
【问题描述】:
我在尝试使用无服务器框架部署 lambda 时遇到权限问题。
它实际上不适用于简单的(QuickStart-given 示例),我在 AWS 上拥有管理员权限。
所以我想知道我可能做错了什么。
据我了解,它可能与授予 CloudFormation 的权限有关,但我不知道如何正确设置以使其运行。
尝试时
$ serverless deploy -v --region eu-west-1
我收到以下错误:
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - slstest-dev
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_FAILED - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - DELETE_IN_PROGRESS - AWS::CloudFormation::Stack - slstest-dev
CloudFormation - DELETE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - DELETE_COMPLETE - AWS::CloudFormation::Stack - slstest-dev
Serverless: Operation failed!
Serverless: View the full error output: https://eu-west-1.console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stack/detail?stackId=arn%3Aaws%3Acloudformation%3Aeu-west-1%3A175264504000%3Astack%2Fslstest-dev%2Fa097e1b0-994a-11eb-b621-0ad1aa52c931
Serverless Error ----------------------------------------
An error occurred: ServerlessDeploymentBucket - API: s3:CreateBucket Access Denied.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 14.16.0
Framework Version: 2.33.1
Plugin Version: 4.5.3
SDK Version: 4.2.2
Components Version: 3.8.1
我通过这样做创建了一个无服务器服务
$ serverless
Serverless: No project detected. Do you want to create a new one? Yes
Serverless: What do you want to make? AWS Python
Serverless: What do you want to call this project? slstest
Project successfully created in 'slstest' folder.
You can monitor, troubleshoot, and test your new service with a free Serverless account.
Serverless: Would you like to enable this? No
You can run the “serverless” command again if you change your mind later.
$ cd slstest
这是我的serverless.yml:
service: slstest
frameworkVersion: '2'
provider:
name: aws
runtime: python3.8
lambdaHashingVersion: 20201221
functions:
hello:
handler: handler.hello
events:
- httpApi:
path: /hello
method: post
我的~/.aws/credentials 文件包含
[default]
aws_access_key_id=<key>
aws_secret_access_key=<secret>
指的是管理员帐户。
【问题讨论】:
标签: lambda deployment serverless-framework