Discussion:
[Fab-user] Problem running any command on an EC2 instance
Ognen Duzlevski
2014-09-19 00:54:16 UTC
Permalink
Hello,

I have a fabric script that provisions an instance with an elastic IP.

The succession of steps is:

public_ip = provision_instance()
with
settings(host_string=public_ip,user='ubuntu',key_filename=ssh_key,reject_unknown_hosts=False,disable_known_hosts=True):
run("ls -l")

First time I run the script I see that the machine is provisioned (via
the AWS console) but the run("ls -l") step fails with a timeout exception.

If I then go back and comment out the first step (the
provision_instance() step) and re-run the script, the command run("ls
-l") runs just fine.
Also, when the script fails the first time I can ssh to the EC2 instance
from the same terminal just fine.

The provision_instance() function does not finish until the status of
the instance is "running" and both status checks (2/2) are OK so I know
the instance is accessible via ssh.

What gives? :-)

Thanks!
ODDO

Loading...