Iza*_*nus 5 linux amazon-ec2 cloud-init
我有一个简单的cloud-init用户数据,我将其传递给ec2.我通过右键单击实例并在其中设置用户数据,在我的ec2实例上设置此数据.
以下是我的cloud-init用户数据
#cloud-config
runcmd:
- [ ls, -l, / ]
- [ sh, -xc, "echo $(date) ': hello world!'" ]
- [ sh, -c, echo "=========hello world'=========" ]
- [ touch, /home/ec2-user/hello.txt ]
final_message: "The system is finally up, after 10 seconds"
Run Code Online (Sandbox Code Playgroud)
我从这里得到了这个例子,我添加了touch命令
我的期望是看到/var/log/cloud-init.log上的数据.但我不认为那里.此外,我没有看到任何错误,也没有看到创建的hello.txt文件
有什么东西我错过了吗?
我正在运行亚马逊linux实例而不是ubuntu实例
这是第3个命令中的语法错误:
- [ sh, -c, echo "=========hello world'=========" ]
Run Code Online (Sandbox Code Playgroud)
这是一个有效的用户数据:
#cloud-config
runcmd:
- [ ls, -l, / ]
- [ sh, -xc, 'echo $(date) ": hello world!"' ]
- [ sh, -c, 'echo "=========hello world========="' ]
- [ touch, /home/ec2-user/hello.txt ]
final_message: "The system is finally up"
output : { all : '| tee -a /var/log/cloud-init-output.log' }
Run Code Online (Sandbox Code Playgroud)
请注意,它仅显示cloud-init执行日志/var/log/cloud-init.log.你应该/var/log/cloud-init-output.log在指定output指令后看到输出.