启动新实例时,我需要运行自定义脚本。最低实例配置为2,因此我始终有2个实例在运行。
我执行了以下步骤来配置和检查用户数据;
<script>
echo Current date and time >> %SystemRoot%\Temp\test.log
echo %DATE% %TIME% >> %SystemRoot%\Temp\test.log
</script>
启动后,我进入远程桌面并检查%SystemRoot%\ Temp 路径,但未创建test.log。
所以我验证了aws文档中指定的日志,并找到了以下日志
2018/06/07 00:21:01Z: Userdata execution begins
2018/06/07 00:21:01Z: Zero or more than one <persist> tag was not provided
2018/06/07 00:21:01Z: Unregistering the persist scheduled task
2018/06/07 00:21:03Z: Zero or more than one <runAsLocalSystem> tag was not provided
2018/06/07 00:21:03Z: Zero or more than one <script> tag was not provided
2018/06/07 00:21:03Z: Zero or more than one <powershellArguments> tag was not provided
2018/06/07 00:21:03Z: <powershell> tag was provided.. running powershell content
2018/06/08 09:41:39Z: Userdata execution begins
2018/06/08 09:41:39Z: Failed to get metadata: The result from http://169.254.169.254/latest/user-data was empty
2018/06/08 09:41:44Z: Unable to execute userdata: Userdata was not provided
2018/06/08 09:41:44Z: Userdata execution done
2018/06/08 10:26:28Z: Userdata execution begins
2018/06/08 10:26:28Z: Failed to get metadata: The result from http://169.254.169.254/latest/user-data was empty
2018/06/08 10:26:32Z: Unable to execute userdata: Userdata was not provided
2018/06/08 10:26:32Z: Userdata execution done
有人能帮助我错过的地方吗?