[英]How to confirm the aws cloudformation validate-template command from shell script?
I want to validate cloud formation template from shell script.我想从 shell 脚本验证云形成模板。
I use aws cloudformation validate-tempate command:我使用 aws cloudformation validate-tempate 命令:
aws cloudformation validate-template --template-body file://template.yaml
But the output of the command is a colon (:) that wait for a confirmation after execution.但是命令的output是一个冒号(:),执行后等待确认。 How can I confirm it and check the status code of a command?
我如何确认它并检查命令的状态代码?
I tried yes
command but it did not work:我尝试了
yes
命令,但它没有用:
yes q | aws cloudformation validate-template --template-body file://template.yaml
I can't reproduce the column (:) behavior you describing.我无法重现您描述的列 (:) 行为。 Here is the expected output and status code check.
这是预期的 output 和状态代码检查。
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
doesn't validate much. aws cloudformation validate-template
验证不多。 I'd recommend trying the CloudFormation Linter , which will catch many more issues before deploying.我建议尝试CloudFormation Linter ,它会在部署前发现更多问题。 The Visual Studio Code extension can show all of those errors inline while authoring templates as well
Visual Studio Code 扩展可以在编写模板时内联显示所有这些错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.