简体   繁体   English

AWS云形成更新包

[英]aws cloud formation update packages

In aws cloud formation I know you can update the stack by updating the json file and those changes will take affect but how could I just update the stacks packages for example yum update or apt update etc ? 在AWS云形成中,我知道您可以通过更新json文件来更新堆栈,这些更改将生效,但是我如何才能更新堆栈包,例如yum updateapt update等?

Thanks in advance 提前致谢

Here is the sample for you on how to handle your problem. 这是为您提供有关如何处理问题的示例。

Update the code in Cloudformation template in userdata . 更新userdata中Cloudformation模板中的代码。

 "UserData"       : { "Fn::Base64" : { "Fn::Join" : ["", [
             "yum update -y \n",

             "# Install the files and packages from the metadata\n",
             "/opt/aws/bin/cfn-init -v ",
             "         --stack ", { "Ref" : "AWS::StackName" },
             "         --resource WebServerInstance ",
             "         --configsets InstallAndRun ",
             "         --region ", { "Ref" : "AWS::Region" }, "\n"
        ]]}}

If you need know cfn-init, read this url cfn-init 如果您需要了解cfn-init,请阅读此网址cfn-init

If you need a sample template, see here: Deploying Applications on Amazon EC2 with AWS CloudFormation 如果您需要示例模板,请参阅此处: 使用AWS CloudFormation在Amazon EC2上部署应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM