关于亚马逊网络服务:AWS:CloudFormation 如何知道模板已部署?

AWS: How does CloudFormation know a template has been deployed?

在这篇文章中,有一个关于 CloudFormation 的很好的解释。

If you dona€?t know CloudFormation, then ita€?s important to know that CloudFormation is the Infrastructure as Code (IaC) solution of AWS. It is in the same category of tools as Terraform (a very good comparison between CloudFormation and Terraform can be found here).

With CloudFormation you can declaratively specify the AWS infrastructure that you need for your cloud application in a YAML or JSON file, called a template, and then deploy this template. During the deployment, AWS automatically provisions all the resources that you specified in your template.

If you already deployed before and just made changes to your template, then AWS calculates a changeset and applies it, so that the state of your infrastructure matches your the specification (just like Kubernetes).

想象以下场景:

  • 创建一个新项目并为此项目设置 CloudFormation 模板。
  • 成功部署此模板。
  • 然后,更改代码。
  • 再次部署它。
  • 就 step4 而言,CloudFormation 是如何知道这个堆栈之前创建的,然后更新它?

    模板中是否有唯一的 UUID 来标识与该模板相关的所有资源?


    标识符是您在使用 create-stack 命令部署模板时指定的堆栈名称,因为它在您创建堆栈的区域中应该是唯一的。


    嗯,你实际上是使用新模板/新参数值主动更新某个堆栈。