#!/usr/bin/env python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Copyright © 2015, by Phil D. Howard - all other rights reserved # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # The author may be contacted using the short first name, middle initial, # and last name, separated by periods, with gmail dot com as the host part # of an email address. # # The above copyright applies to the coding. # # The contained information is copyrighted and/or trademarked by # Amazon Web Services, Inc. or its affiliates and used under fair use. #----------------------------------------------------------------------------- # script aws_regions.py # module aws_regions # purpose aws region info # email 10766533880931004261116704991675704284199532346468429677 #----------------------------------------------------------------------------- from __future__ import division, print_function """ Amazon Web Services (AWS) region info """ # ( long id, short id, full name/description, available virtualizations ) aws_regions = [ ('us-east-1', 'use1', 'N. Virginia', { 'hvm', 'pv' } ), ('us-east-2', 'use2', 'Ohio', { 'hvm' } ), ('us-west-1', 'usw1', 'N. California', { 'hvm', 'pv' } ), ('us-west-2', 'usw2', 'Oregon', { 'hvm', 'pv' } ), ('ca-central-1', 'cac1', 'Central', { 'hvm' } ), ('eu-west-1', 'euw1', 'Ireland', { 'hvm', 'pv' } ), ('eu-central-1', 'euc1', 'Frankfurt', { 'hvm', 'pv' } ), ('eu-west-2', 'euw2', 'London', { 'hvm' } ), ('ap-southeast-1', 'ase1', 'Singapore', { 'hvm', 'pv' } ), ('ap-southeast-2', 'ase2', 'Sydney', { 'hvm', 'pv' } ), ('ap-northeast-1', 'ane1', 'Tokyo', { 'hvm', 'pv' } ), ('ap-northeast-2', 'ane2', 'Seoul', { 'hvm' } ), ('ap-south-1', 'aps1', 'Mumbai', { 'hvm' } ), ('sa-east-1', 'sae1', 'Sao Paulo', { 'hvm', 'pv' } ), ] aws_regions_dict = {} for r in aws_regions: aws_regions_dict[r[0]] = r aws_regions_dict[r[1]] = r aws_regions = tuple( sorted( aws_regions ) ) aws_regions_list_long = tuple(([a[0] for a in aws_regions])) aws_regions_list_short = tuple(([a[1] for a in aws_regions])) aws_regions_list_name = tuple(([a[2] for a in aws_regions])) aws_regions_list_any = aws_regions_list_long+aws_regions_list_short aws_regions_list_all = aws_regions_list_any+aws_regions_list_name aws_regions_set_long = set(aws_regions_list_long) aws_regions_set_short = set(aws_regions_list_short) aws_regions_set_name = set(aws_regions_list_name) aws_regions_set_any = aws_regions_set_long|aws_regions_set_short aws_regions_set_all = aws_regions_set_any|aws_regions_set_name aws_regions_long_to_short = {a[0]:a[1] for a in aws_regions} aws_regions_short_to_long = {a[1]:a[0] for a in aws_regions} aws_regions_long_to_name = {a[0]:a[2] for a in aws_regions} aws_regions_short_to_name = {a[1]:a[2] for a in aws_regions} aws_regions_name_to_long = {a[2]:a[0] for a in aws_regions} aws_regions_name_to_short = {a[2]:a[1] for a in aws_regions} aws_regions_any_to_long = dict([(a[0],a[0]) for a in aws_regions]+[(a[1],a[0]) for a in aws_regions]+[(a[2],a[0]) for a in aws_regions]) aws_regions_any_to_short = dict([(a[0],a[1]) for a in aws_regions]+[(a[1],a[1]) for a in aws_regions]+[(a[2],a[1]) for a in aws_regions]) aws_regions_any_to_name = dict([(a[0],a[2]) for a in aws_regions]+[(a[1],a[2]) for a in aws_regions]+[(a[2],a[2]) for a in aws_regions]) aws_regions_long_to_virt = {a[0]:a[3] for a in aws_regions} aws_regions_short_to_virt = {a[1]:a[3] for a in aws_regions} aws_regions_any_to_virt = dict([(a[0],a[3]) for a in aws_regions]+[(a[1],a[3]) for a in aws_regions]+[(a[2],a[3]) for a in aws_regions]) def main( args ): for r in aws_regions: print(r[0]) return if __name__ == '__main__': from sys import argv, stderr, stdout result = main( argv ) stdout.flush() try: exit( int( result ) ) except ValueError: print( str( result ), file=stderr ) exit( 1 ) except TypeError: if result == None: exit( 0 ) exit( 255 ) finally: pass # EOF