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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Python with boto script aws...help!

  • 23-11-2013 4:37pm
    #1
    Registered Users, Registered Users 2 Posts: 196 ✭✭


    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, Registered Users 2 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, Registered Users 2 Posts: 196 ✭✭Senor Frog


    I keep getting the following error:


  • Registered Users, Registered Users 2 Posts: 6,289 ✭✭✭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