How to check reboot?

I want to reload some instances using ec2.reboot_instances([instanceId]) and this works fine, but:

  • How to check reboot? I thought launch_time would be changed, but it looks like all options remain the same. I would prefer to do this check without ssh or ping - is this possible? Is it possible to use instance.get_console_output() some way?

  • This is not clear from the docs if I have to add an instance status check before attempting a reboot. If the instance is completed, the request will be ignored, this is clear - but if it is stopped or waiting for a response - should I use something else instead of (start)?

+4
source share
1 answer

This shell command will give you how long the system has been booted:

 ssh hostname uptime 

To automate it, you will want to add the public ssh key to the .ssh/authorized_keys file on the host.

With boto, this will probably be something like this (although I did not use boto):
 s = boto.manage.cmdshell.SSHClient(hostname, uname='root') s.run('uptime') 

See the link to the boto control module

+7
source

Source: https://habr.com/ru/post/1443064/


All Articles