简体   繁体   中英

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 ?

Thanks in advance

Here is the sample for you on how to handle your problem.

Update the code in Cloudformation template in userdata .

 "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

If you need a sample template, see here: Deploying Applications on Amazon EC2 with AWS CloudFormation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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