[英]AWS CloudFormation create-stack vs deploy
Can someone clearly explain to me difference and precedence between AWS CLI Cloudformation create-stack
and deploy
commands? 有人可以清楚地向我解释AWS CLI Cloudformation create-stack
和deploy
命令之间的区别和优先级吗? For me it seems like they do same thing and deploy resources. 对我来说,似乎他们做同样的事情并部署资源。
Why when you run the deploy command from the cli, the create stack has no executable change set, while the documenation says : 为什么当您从cli运行deploy命令时,create stack没有可执行的更改集,而文档说:
Deploys the specified AWS CloudFormation template by creating and then executing a change set. 通过创建并执行更改集来部署指定的AWS CloudFormation模板。 The command terminates after AWS CloudFormation executes the change set. AWS CloudFormation执行更改集后,该命令将终止。 If you want to view the change set before AWS CloudFormation executes it, use the --no-execute-changeset flag. 如果要在AWS CloudFormation执行更改集之前查看更改集,请使用--no-execute-changeset标志。
create-stack
can only be used when you know you want to create a new stack. create-stack
只能在您知道要创建新堆栈时使用。 If you want to update a stack, you have to use a different command, etc. If you're writing (ug) batch files to help run your cloudformation, this can be a real pain. 如果要更新堆栈,则必须使用其他命令等。如果您正在编写(ug)批处理文件以帮助运行您的cloudformation,这可能会非常痛苦。
The deploy
is functionality to better take advantage of change sets - rather than having to know if a stack exists, you can simply run deploy and the tool will figure out what it needs to do. deploy
是更好地利用变更集的功能 - 而不是必须知道堆栈是否存在,您可以简单地运行部署,工具将弄清楚它需要做什么。 With the --no-execute-changeset
, it will actually provide you the command needed if you decide you want to review the changes before applying them. 使用--no-execute-changeset
,如果您决定在应用更改之前查看--no-execute-changeset
,它实际上将为您提供所需的命令。
It looks like this was introduced in Nov. 2016, probably around the time change sets were released. 看起来这是在2016年11月推出的,可能是在发布变更集的时候。
I assume that deploy
is just 'syntactic sugar' around the CreateChangeSet
, CreateStack
, and UpdateStack
api methods. 我假设deploy
只是围绕CreateChangeSet
, CreateStack
和UpdateStack
api方法的“语法糖”。
Note that although deploy
is in the CLI , it is not in the API reference . 请注意,尽管deploy
在CLI中 ,但它不在API参考中 。
I assume that deploy
is preferred outside of any need to explicitly review a change set. 我假设在明确审查更改集之前,首选deploy
是首选。 Without using deploy
you would potentially need to create-change-set
then decide whether to create or update a stack. 在不使用deploy
您可能需要create-change-set
然后决定是创建还是更新堆栈。 In this case, deploy is like a stack "upsert". 在这种情况下,部署就像堆栈“upsert”。
I stopped being lazy and checked the code, and yes - deploy
is ultimately a nicer way of using cloudformation from the CLI. 我停止了懒惰并检查了代码,是的 - deploy
最终是从CLI使用云信息的一种更好的方式。 The implementation is here and here . 实施就在这里和这里 。 Note that as of today the ability to control rollback behaviour doesn't existing for deploy
per this issue . 请注意,截至目前,根据此问题 , deploy
控制回滚行为的能力不存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.