amazon-web-services - 如何从 shell 脚本确认 aws cloudformation validate-template 命令?

标签 amazon-web-services aws-cloudformation

我想通过 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/

相关文章:

ruby-on-rails - 云形成中 "Rails App Server"的类型是什么?

amazon-web-services - 身份验证 AWS Cognito SRP

amazon-web-services - CloudFormation 动态引用不同区域的 Secret

amazon-web-services - AWS SQS + API 网关 + Lambda + 数据库

amazon-web-services - Cloudformation,无法创建类型为 `AWS::MSK::Configuration` 的资源

aws-lambda - 如何从 CFN 资源 "DependsOn"Lambda 函数?

amazon-web-services - 如何通过 AWS SAM 提供 Lambda S3 策略

json - 在安全组中使用前缀列表

amazon-web-services - CloudWatch 警报的正则表达式

amazon-web-services - 从在 VPC 中运行的 AWS Lambda 访问 ECS 实例