cloud-init - the first-boot initialisation of cloud instances (user data, SSH keys, hostname, packages)
cloud-init status [--long] [--wait] | cloud-init query KEY
Options you will use
status- did the boot stages finish? done, running, error, degraded (done with warnings)
--long- with the details: extended status, last update, the errors
--wait- block until cloud-init has finished
query KEY- read instance data (v1.instance_id, v1.region, v1.availability_zone ...)
Examples
$ cloud-init status --longdid the user data succeed, and if not, which module failed
$ sudo tail -50 /var/log/cloud-init-output.logwhat the script printed
Gotchas
- Exit status of
status: 0 done, 1 error, 2 degraded (recoverable errors). - What the user data printed is in /var/log/cloud-init-output.log; cloud-init's own log is /var/log/cloud-init.log. The same output is in
aws ec2 get-console-outputfrom outside. - User data runs ONCE, at the first boot, as root. Changing it on a stopped instance does nothing unless you make it run again (a launch template version + instance refresh is the usual way).
Try cloud-init in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.