I am using Python to launch an ec2 instance, after I get "running" state of my instance, I am trying to SCP a shell script and run it via ssh.
I am getting the following error
"ssh: connect to host ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com port 22: Connection refused"
When I check in the console, the Status check is "Initializing", once It changes "2/2 checks passed", I am able to ssh or run any script.
Is there any way I can get the "status check" via python boto API?
I am using Python 2.7.5+, boto 2.19.0
Thanks in advance.
Lazy way
Simple way is to check the port 22 of the newly created instance is reachable or not by using
socket
moduleWhen you will able to reach the port 22 then you can invoke ssh to it.