如何解决如何从shell脚本确认aws cloudformation validate-template命令?
我想从shell脚本验证云形成模板。
我使用aws cloudformation validate-tempate命令:
aws cloudformation validate-template --template-body file://template.yaml
但是命令的输出是冒号(:),等待执行后确认。 如何确认并检查命令的状态码?
我尝试了yes
命令,但没有用:
yes q | aws cloudformation validate-template --template-body file://template.yaml
解决方法
我无法重现您描述的列(:)行为。这是预期的输出和状态代码检查。
aws cloudformation validate-template --template-body file://good-template.yaml
... dump of the template
echo $?
0 //status is OK
aws cloudformation validate-template --template-body file://bad-template.yaml
An error occurred (ValidationError) when calling the ValidateTemplate operation: Template format error: JSON not well-formed. (line 615,column 1)
echo $?
255 //status is error
,
aws cloudformation validate-template
验证不多。我建议尝试使用CloudFormation Linter,它会在部署之前捕获更多的问题。 Visual Studio Code extension可以在创作模板的同时内嵌显示所有这些错误
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。