When creating a Linux AMI in AWS with CloudFormation, I can view the output of the Cloud Init scripts, for example if I have a UserData section that echoes to stdout:
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash -xe\n",
"echo hello, stdout\n"
]
]
}
}
Then /var/log/cloud-init-output.log
will contain these lines:
+ echo hello, stdout
hello, stdout
What is the equivalent log file for Windows AMIs? Is it somewhere in http://169.254.169.254/
, or is it a log file somewhere?
According to the documentation you have to wrap UserData
with <script></script>
. The log is written to either C:\Logs
or C:\Log
depending on whether EC2Launch
or EC2Config
is used.
According to the same document, this should work on all Windows instances by default unless you expressly use EC2Config
.
By default, all Amazon AMIs have user data execution enabled for the initial boot. For instances using the EC2Config service, you can specify that user data must be executed on the next boot or restart of the service. For more information, see Ec2 Service Properties.
Even more information is available on another question.
For Windows 2016 AMIs that's C:\ProgramData\Amazon\EC2-Windows\Launch\Log\UserdataExecution.log
, where ProgramData is a hidden folder...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With