拥有此example中的Configset:
"AWS::CloudFormation::Init" : {
"configSets" : {
"ascending" : [ "config1" , "config2" ],
"descending" : [ "config2" , "config1" ]
},
"config1" : {
"commands" : {
"test" : {
"command" : "echo \"$CFNTEST\" > test.txt",
"env" : { "CFNTEST" : "I come from config1." },
"cwd" : "~"
}
}
},
...
}
如果我添加命令/修改现有命令,如下所示:
"config1" : {
"commands" : {
"test" : {
"command" : "echo \"$CFNTEST\" > test.txt",
"env" : { "CFNTEST" : "I come from config1." },
"cwd" : "~"
},
"test2" : {
"command" : "echo \"$CFNTEST\" > test2.txt",
"env" : { "CFNTEST" : "I come from config2." },
"cwd" : "~"
}
}
}
是否会创建文件test2.txt
?如果是,如果我修改"env"
,会发生什么?
答案 0 :(得分:2)
如果这些命令仅在cfn-init期间运行,则在堆栈更新期间不会运行它们。只有新实例才会运行更新的命令。
如果您更新了堆栈,则需要使用cfn-hup重新运行cfn-init。