简体   繁体   English

AWS CloudFormation创建堆栈与部署

[英]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-stackdeploy命令之间的区别和优先级吗? 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只是围绕CreateChangeSetCreateStackUpdateStack 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.

相关问题 AWS Cloudformation 创建堆栈模板错误 - AWS Cloudformation Create-Stack Template Error AWS CloudFormation 创建堆栈服务资源挂在“CREATE_IN_PROGRESS” - AWS CloudFormation Create-Stack Service Resource Hanging at 'CREATE_IN_PROGRESS' AWS CLI cloudformation 验证模板成功,但在创建堆栈期间出错 - AWS CLI cloudformation validate-template success but getting error during create-stack 执行[aws cloudformation create-stack]后如何自动提取VPCID,PrivateSubnet1,PublicSubnet1,S3BucketName和DBSubnetGroup - How to extract VPCID, PrivateSubnet1, PublicSubnet1, S3BucketName & DBSubnetGroup automatically after executing [aws cloudformation create-stack] AWS Cloudformation - 堆栈与 NestedStack - AWS Cloudformation - Stack vs NestedStack AWS Codepipeline 将 cloudformation 部署到开发账户并使用输出堆栈在中央账户中创建参数存储。 可能吗? - AWS Codepipeline deploy cloudformation to Dev account and use output stack to create Parameter store in Central account . Posible? 如何在单个CloudFormation堆栈上创建2个AWS Lambda? - How to create 2 AWS lambdas on a single CloudFormation stack? AWS CloudFormation bash部署脚本与模板命令 - AWS CloudFormation bash deploy script vs template commands 通过AWS CLI创建AWS dynamodb表并将其附加到cloudformation堆栈 - Create AWS dynamodb table via aws cli and attach it to a cloudformation stack 无法创建 CloudFormation 堆栈以从 AWS Backup for FsxN 创建卷 - Unable to create a CloudFormation stack to create a Volume from AWS Backup for FsxN
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM