Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Python with boto script aws...help!

Options
  • 23-11-2013 5:37pm
    #1
    Registered Users Posts: 193 ✭✭


    I'm new to python and programming in general. I have been trying to write a script in python implementing the boto library to monitor instances that are running in my EC2 amazon web services account. Below is my script:
    __________________________________________________________
         import boto
         import boto.ec2
         import time
    
         key_id = "*******"
         secret_key = "********"
    
        region = boto.ec2.get_region("eu-west-1", aws_access_key_id=key_id,                                                                                  aws_secret_access_key=secret_key)
        print region
    
                                                                                                                                                                         conn =    boto.connect_ec2(aws_access_key_id=key_id,aws_secret_access_key=secret_key,region=region)
    
            reservation = conn.run_instances('<ami-a63edbd1>',key_name='*******')
    
            for inst in reservation.instances:
            if instance.state == u'running' :
            
             print "Running AWS EC2 instances"
             print"%s" % (inst.id, inst.type, region.placement, inst.launch_time)
    
    __________________________________________________________

    Any help would be much appreciated! Thanks


Comments

  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Indentation is not optional, use code tags when pasting python here.

    Like this:
       print "this stuff is inside code tags"
    


  • Registered Users Posts: 193 ✭✭Senor Frog


    I keep getting the following error:


  • Registered Users Posts: 6,178 ✭✭✭Talisman


    The error message tells you exactly what the problem is:

    < is <
    > is >
    reservation = conn.run_instances('<ami-a63edbd1>',key_name='*******')

    So get rid of the angle brackets in the line above.


Advertisement