amazon-web-services - Waiter ChangeSetCreateComplete failed: Waiter 遇到终端故障状态
问题描述
我正在关注 CloudFormation 教程,这是我的 AWS CloudFormation 模板:
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: A starter AWS Lambda function.
Resources:
helloworldpython3:
Type: 'AWS::Serverless::Function'
Properties:
Handler: app.lambda_handler
Runtime: python3.6
CodeUri: src/
Description: A starter AWS Lambda function.
MemorySize: 128
Timeout: 3
Environment:
Variables:
TABLE_NAME: !Ref Table
REGION_NAME: !Ref AWS::Region
Events:
HelloWorldSAMAPI:
Type: Api
Properties:
Path: /hello
Method: GET
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref Table
Table:
Type: AWS::Serverless::SimpleTable
Properties:
PrimaryKey:
Name: greeting
Type: String
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
我可以使用aws cloudformation package
. 但是当我尝试使用 部署它时sam deploy
,我从 shell 中得到了这个输出:
错误:等待创建变更集。错误:无法为堆栈创建变更集:hello-world-sam,例如:Waiter ChangeSetCreateComplete 失败:Waiter 遇到终端故障状态:对于表达式“状态”,我们匹配预期路径:“失败”状态:失败。原因:无效的模板属性或属性 [Table]
解决方案
您的 YAML 格式不正确:
AWSTemplateFormatVersion: "2010-09-09"
Transform: "AWS::Serverless-2016-10-31"
Description: A starter AWS Lambda function.
Resources:
helloworldpython3:
Type: "AWS::Serverless::Function"
Properties:
Handler: app.lambda_handler
Runtime: python3.6
CodeUri: src/
Description: A starter AWS Lambda function.
MemorySize: 128
Timeout: 3
Environment:
Variables:
TABLE_NAME: !Ref Table
REGION_NAME: !Ref AWS::Region
Events:
HelloWorldSAMAPI:
Type: Api
Properties:
Path: /hello
Method: GET
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref Table
Table:
Type: AWS::Serverless::SimpleTable
Properties:
PrimaryKey:
Name: greeting
Type: String
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
Table
应该在Resources
. 使用像cfn-python-lint这样的 linter
推荐阅读
- java - Java用表情符号替换文本
- xml - PowerShell解析XML文件
- sensors - PIR 运动传感器每小时触发一次
- git - 为什么我的 .gitattributes 文件没有阻止在 Windows 上签出文件时添加“\r”?
- laravel - 如何在 Laravel 8 中更改 Jetstream 徽标?
- python - 即使我创建新列表 Python,嵌套列表变量也会发生变化
- postgresql - 无法在 postgresql 中为 Json 数据生成生成列
- api - 如何在 OpenAPI (Swagger) 语法中描述嵌套的请求体?
- php - Laravel Nova 变形问题
- java - 如何从第二个 Activity 获取 ArrayList 并将其显示在 Main Activity 的 Recycler 视图中