()
return region_az
Generates a dict of {'region': [availability_zones, az2]}
Generates a dict of {'region': [availability_zones, az2]}
Generates a dict of { region : [ availability_zones az2 ] }
def generate_region_AZ_dict():
    """ Generates a dict of {'region': [availability_zones, az2]} """
    print "Getting all regions and AZ's... (this may take some time)"
    region_az = {}
    for region in uconf.AWS_REGIONS:
        client = boto3.setup_default_session(region_name=region)
        client = boto3.client('ec2', aws_access_key_id=uconf.AWS_ACCESS_KEY_ID, aws_secret_access_key=uconf.AWS_SECRET_ACCESS_KEY)

        avail_zones = []
        for zone in client.describe_availability_zones()['AvailabilityZones']:
            if zone['State'] == 'available':
                avail_zones.append(zone['ZoneName'])
        region_az[region] = avail_zones
        print ">>", region

    return region_az
def generate_region_AZ_dict ( ) : print "Getting all regions and AZ's... (this may take some time)" region_az = { } for region in uconf . AWS_REGIONS : client = boto3 . setup_default_session ( region_name = region ) client = boto3 . client ( 'ec2' , aws_access_key_id = uconf . AWS_ACCESS_KEY_ID , aws_secret_access_key = uconf . AWS_SECRET_ACCESS_KEY ) avail_zones = [ ] for zone in client . describe_availability_zones ( ) [ 'AvailabilityZones' ] : if zone [ 'State' ] == 'available' : avail_zones . append ( zone [ 'ZoneName' ] ) region_az [ region ] = avail_zones print ">>" , region return region_az