CloudFormation 模板位于实例上的哪个位置,由 cloud-init 调用?

Where is CloudFormation template located on the instance, which is called by cloud-init?

我理解 AWS::CloudFormation::Init block of the template is executed by cfn-init 脚本。

这是我用来执行此操作的语法:

/usr/local/bin/cfn-init -v --stack  WebS<erver1 --resource WebServerInstance --region eu-central-1 --configset InstallAndRun && cat /var/log/cfn-init.log

我可以通过 UserData 或 SSH 进行调用。

现在我想修改模板的 AWS::CloudFormation::Init 部分并通过 ssh 重复 cnf-init 调用。

问题: cfn-init 执行的云形成代码文件在我的实例上在哪里?

所有云初始化文件都在 /var/lib/cloud(在 Centos 7 上),用户数据脚本在 /var/lib/cloud/instance

看我的另一个回答 有关 cloud-init 源位置的一般提示,执行顺序

cfn-init 命令使用位于 /var/lib/cfn-init/data/metadata.json 的配置文件。 JSON 文件包含在 Cloud Formation 模板的 AWS::CloudFormation::Init 块中定义的配置集。

上面的路径我已经在亚马逊上确认过Linux 2.在其他操作系统上的位置可能不同