(InsufficientCapabilitiesException):要求功能:[CAPABILITY_AUTO_EXPAND]

问题描述 投票:0回答:1

基于本地AWS Cloud Formation .yaml文件。我正在运行以下命令

aws cloudformation create-stack --stack-name someTest --template-body file://template.yaml

引发以下错误

An error occurred (InsufficientCapabilitiesException) when calling the CreateStack operation: Requires capabilities : [CAPABILITY_AUTO_EXPAND]

我已阅读here,这与模板包含macros的事实有关。在这种情况下,在.yaml文件内部,它将调用AWS::Serverless::Function,即

Resources:
  ResourceName:
    Type: AWS::Serverless::Function 
    ...
    ...

创建堆栈时解决此问题的选项有哪些?

amazon-web-services amazon-cloudformation
1个回答
0
投票

解决方案:

只需追加

--capabilities CAPABILITY_AUTO_EXPAND

到命令

aws cloudformation create-stack --stack-name someTest --template-body file://template.yaml --capabilities CAPABILITY_AUTO_EXPAND

说明:

作为documentation状态,宏对模板执行自定义处理,例如操作和转换。在此示例中,AWS::Serverless转换“采用以AWS Serverless Application Model语法编写的模板,并将其转换并扩展为兼容的AWS CloudFormation模板”。

因此,当在包含宏的模板上调用create-stack操作时,它应指定功能 CAPABILITY_AUTO_EXPAND

© www.soinside.com 2019 - 2024. All rights reserved.