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
user data
, when create new instance in cloudformation template. – BMWcfn-init
to refresh the service. now I know how to answer your question. – BMW