AWS SAM 部署错误 - 验证错误 | CreateChangeSet 操作错误
Posted
技术标签:
【中文标题】AWS SAM 部署错误 - 验证错误 | CreateChangeSet 操作错误【英文标题】:AWS SAM Deploy error - Validation Error | CreateChangeSet Operation Error 【发布时间】:2020-10-21 15:43:55 【问题描述】:我在尝试 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
【问题讨论】:
你能把你的cloudformation
模板贴在这里吗?
添加了模板
***.com/questions/57932734/… 这似乎是类似的问题?
是的,它非常相似。我使用了有关该问题的信息并得到了解决方案。谢谢@dinakaran
【参考方案1】:
据我了解,当进行初始部署并且初始部署失败时会遇到该错误。因此,某些东西会中断,部署服务无法成功执行。要解决此问题,只需删除 aws cloudformation stack
并重新部署即可。
可以使用以下命令删除:
aws cloudformation delete-stack --stack-name <insert stack-name>
Reference
【讨论】:
兄弟,你是一个合法的救生员【参考方案2】:可能需要先运行sam build
,以便您的资源可以获取最新更改
【讨论】:
以上是关于AWS SAM 部署错误 - 验证错误 | CreateChangeSet 操作错误的主要内容,如果未能解决你的问题,请参考以下文章