def services_for_instance(instance_id):
 ec2 = boto.ec2.connect_to_region(REGION)
 reservations = ec2.get_all_instances(instance_ids=[instance_id])
 for reservation in reservations:
  for instance in reservation.instances:
   if (instance.id == instance_id):
    try:
     services = instance.tags['services'].split(',')
    except KeyError as ke:
     msg = "Tag named 'services' not found on this instance({})".format(instance_id)
     raise Exception(msg)
    for service in services:
     (yield service)

def services_for_instance ( instance_id ) : ec2 = boto . ec2 . connect_to_region ( REGION ) reservations = ec2 . get_all_instances ( instance_ids = [ instance_id ] ) for reservation in reservations : for instance in reservation . instances : if ( instance . id == instance_id ) : try : services = instance . tags [ 'services' ] . split ( ',' ) except KeyError as ke : msg = "Tag named 'services' not found on this instance({})" . format ( instance_id ) raise Exception ( msg ) for service in services : ( yield service )
get the list of all services named by the services tag in this instances tags .