I want to reboot some instances using ec2.reboot_instances([instanceId]) and
that works fine but:
-
how to verify a reboot occurs? I thought
launch_timewill be changed but looks like all parameters remains the same.. I’d prefer to do this check without ssh or ping – is it possible? May be it’s possible to useinstance.get_console_output()somehow? -
it’s not clear from the docs if I should add some instance status check before trying to reboot. If instance is terminated request will be ignored, that’s clear – but if is’s stopped or pending – should I use something else instead (start)?
This shell command will give you how long the system has been booted:
To automate it you will want to add you ssh public key to the
.ssh/authorized_keysfile on the host.With boto it would probably be something like this (although I’ve not used boto):
See the reference on the boto manage module