如何快速有效地调试 CloudFormation 模板? [英] How can I quickly and effectively debug CloudFormation templates?

查看:30
本文介绍了如何快速有效地调试 CloudFormation 模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CloudFormation 是一个强大的 AWS 产品,允许以编程方式创建 AWS 资源堆栈,例如 应用程序的网络层, 高性能计算集群,一个完整的应用程序堆栈, 只需一个 API 调用.它非常强大.使用它肯定被认为是一种很好的 AWS 实践,尤其是当它与 Chef, Puppet,cloud-init. 调试它驱使我成为副手.

CloudFormation is a powerful AWS offering that allows the programmatic creation of AWS resource stacks, such as the web tier of an application, a high performance computing cluster, or an entire application stack, with a single API call. It is immensely powerful. Using it is surely considered a good AWS practice, especially when it's combined with Chef, Puppet, or cloud-init. Debugging it drives me to vice.

以生产为例:股票 mongodb 集群模板 对我不起作用.我不知道为什么.我相信这很简单,因为它几乎总是如此.我的问题不是我无法弄清楚出了什么问题.假设堆栈完全正确删除资源,它需要 20 到 30 分钟才能失败,然后再删除三到四分钟.

Take a production example: The stock mongodb cluster templates won't work for me. I don't particularly know why. I'm sure it's something simple as it almost always is. My problem isn't that I can't figure out what's wrong. It's that it takes the stack between 20 and 30 minutes to fail, and then another three or four minutes to delete, assuming it deletes the resources properly at all.

我错过了什么?我知道 --disable-rollback 标志并将其用作氧气.我很久以前就学会了用 cfn-signal 包装退出消息,然后像压舱物一样把它们扔下沉船.如何让模板调试过程更快,或者我是否会在我犯错半小时后永远注意到我的错误?

What am I missing? I know about the --disable-rollback flag and use it like oxygen. I learned long ago to wrap exit messages with cfn-signal and to throw them like ballast off a sinking ship. How can I make the template debugging process faster, or am I stuck forever noticing my mistakes half an hour after I make them?

推荐答案

使用 aws cloudformation validate-template 命令在 AWS CLI 工具中.它只验证您的模板是有效的 JSON 还是 YAML,而不验证您的键和值是否正确(例如不检查键中的拼写错误)

Use the aws cloudformation validate-template command in the AWS CLI tool. It only validates whether your template is valid JSON or YAML, not whether your keys and values are correct (for example doesn't check for typos in keys)

这篇关于如何快速有效地调试 CloudFormation 模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆