1

Hello I'm following This Tutorial on running shell commands with EC2 instances but I later tried This Method (the first answer).

It still doesn't work. First I got error unexpected keyword argument keypath

Then error 'Reservation' object has no attribute dns_name

So now I'm really confused. I had the instance spooled up and I used the proper instance id as well.

If there is an intuitive way to run a shell command on an AWS instance, I'd like to know. I already have my account and keys setup and I've run shell commands through the CLI but I want to automate the process. Fabric is proving a challenge to figure out.

Community
  • 1
  • 1
Elliott Miller
  • 355
  • 2
  • 5
  • 13

1 Answers1

2

There was actually a bug in the example code that I provided for the second method you mentioned. I have corrected the example code but basically you need to change this:

# Find the instance object related to my instanceId
instance = conn.get_all_instances(['i-12345678'])[0]

to this:

# Find the instance object related to my instanceId
instance = conn.get_all_instances(['i-12345678'])[0].instances[0]

Thanks for finding the problem. I'm surprised no one mentioned it before.

garnaat
  • 44,310
  • 7
  • 123
  • 103