我想通过 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
关于amazon-web-services - 如何从 shell 脚本确认 aws cloudformation validate-template 命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64011147/