from boto.ec2.connection import EC2Connection 
import os 

myid=os.environ['NIMBUS_IAAS_ACCESS_KEY'] 
mypw=os.environ['NIMBUS_IAAS_SECRET_KEY'] 
host = 'svc.uc.futuregrid.org' 
#host = 's83r.idp.sdsc.futuregrid.org' 

ec2conn = EC2Connection(myid, mypw, host=host, port=8444) 
# this next line is due to a bug in early boto versions 
ec2conn.host = host 

# get boto objects for all the instances you wish to kill 
all_inst = ec2conn.get_all_instances() 

# iterate through all the matching instances and stop them 
for res in all_inst: 
    for instance in res.instances: 
        print "Killing %s" % (instance.id) 
        instance.terminate()
