amazon-web-services - AWS SAM 部署错误 - 验证错误 | CreateChangeSet 操作错误
问题描述
尝试使用sam deploy --guided
我的 lambda 应用程序时出现以下错误。
错误:无法为堆栈创建变更集:{stack-name},调用 CreateChangeSet 操作时发生错误 (ValidationError):Stack:arn:aws:cloudformation:ap-southeast-2:014009325916:stack/{stack-name }/f2212bf0-bb41-11ea-8ef3-0aa7af0536b6 处于 ROLLBACK_COMPLETE 状态,无法更新。
这个问题的一些进一步背景是我所有的 lambda 函数都可以not have authorization defined
。不确定这是否相关,但我会在它的情况下说明它。
坦率地说,我不知道如何解决这个问题。任何帮助表示赞赏。
===
背景: 构建自动交易系统
请求 Cloudformation 模板:
yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A tradingview alert wrapper that interprets alerts and makes trades according to them.
Globals:
Function:
# CodeUri: function/.
# Runtime: python3.8
# Policies:
# - AWSLambdaFullAccess
# Tracing: Active
# Timeout: 30
Environment:
Variables:
APIKEY: ""
SECRETKEY: ""
Resources:
tradeFunction:
Type: AWS::Serverless::Function
Properties:
Handler: app.trade
Description: The primary execution function
CodeUri: function/.
Runtime: python3.8
Policies:
- AWSLambdaFullAccess
Tracing: Active
Timeout: 60
Events:
inputResponse:
Type: Api
Auth:
ApiKeyRequired: false
Authorizer: NONE
Properties:
Path: /trade
Method: post
printAccountBalanceFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: function/.
Runtime: python3.8
Policies:
- AWSLambdaFullAccess
Tracing: Active
Timeout: 30
Handler: app.print_account_balance
Description: Returns account balance over time or trade
Events:
inputResponse:
Type: Api
Properties:
Path: /print_account_balance
Method: get
startTradesFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: function/.
Runtime: python3.8
Policies:
- AWSLambdaFullAccess
Tracing: Active
Timeout: 30
Handler: app.start_trades
Description: Resets trade log for a fresh start
Events:
inputResponse:
Type: Api
Properties:
Path: /start_trades
Method: get
retrieveTradeLogFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: function/.
Runtime: python3.8
Policies:
- AWSLambdaFullAccess
Tracing: Active
Timeout: 30
Handler: app.retrieve_trade_log
Description: Return all the trade logs in the dyanamoDB database
Events:
inputResponse:
Type: Api
Properties:
Path: /retrieve_trade_log
Method: get
解决方案
据我了解,当一个人进行初始部署并且初始部署失败时会遇到该错误。结果,出现了一些问题,部署服务无法成功执行。要解决此问题,只需删除aws cloudformation stack
并重新部署即可。
可以使用以下命令删除:
aws cloudformation delete-stack --stack-name <insert stack-name>
推荐阅读
- sqlite - 存储推送通知的最佳做法是什么?离子 3
- swift - “提取 git 版本失败”使用 Mac 的 CocoaPods
- r - Twitter Search API OR 运算符未按预期工作
- python - Python / mysql.connector - 跨多个游标重用单个数据库连接
- javascript - Javascript检测滚轮移动而不实际滚动
- azure-devops - VS TS Build排除minmatch中的子目录
- c# - 当前上下文中不存在名称 AudioLevelUpdated
- object - ROBLOX [Lua] Tycoon - 如何更改我的机器创建的对象类型?
- reactjs - 当 S3 将 /dir 重定向到 /dir/ 时保留查询参数
- javascript - 在 vuejs 中重新渲染模板