def regions(): """ Get all available regions for the ELB service. :rtype: list :return: A list of :class:`boto.RegionInfo` instances """ return get_regions('elasticloadbalancing', connection_cls=ELBConnection)
def regions(): """ Get all available regions for the Amazon Elastic MapReduce service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ return get_regions('elasticmapreduce', connection_cls=EmrConnection)
def regions(): """ Get all available regions for the Auto Scaling service. :rtype: list :return: A list of :class:`boto.RegionInfo` instances """ return get_regions('autoscaling', connection_cls=AutoScaleConnection)
def get_closest_region(service='ec2', repetitions=1): """ Get the closest region for a particular service based on its average response time. :type service: str :param service: The service to attempt a connection to. By default, this is ``ec2``. :type repetitions: int :param repetitions: The number of measurements to take before calculating an average. """ regions = [ region.name for region in regioninfo.get_regions(service) if 'gov' not in region.name and 'cn' not in region.name ] latency = {} for region in regions: connection = Timer( "h.request('GET', '/')", "from http.client import HTTPSConnection; h=HTTPSConnection('%s.%s.amazonaws.com')" % (service, region)) times = connection.repeat(repetitions, 1) avg_latency = sum(times) / float(len(times)) latency[region] = avg_latency logger.info('Average latency to Amazon %s %s is %s' % (service.upper(), region, latency[region])) region = min(latency, key=latency.get) return region
def regions(provider=None): """ Get all available regions for the Route53 service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` instances """ regions = get_regions( 'route53', region_cls=Route53RegionInfo, connection_cls=Route53Connection, provider=provider ) # For historical reasons, we had a "universal" endpoint as well. regions.append( Route53RegionInfo( name='universal', endpoint='route53.amazonaws.com', connection_cls=Route53Connection, provider=provider ) ) return regions
def regions(**kw_params): """ Get all available regions for the Amazon Simple Workflow service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ return get_regions('swf', connection_cls=boto.swf.layer1.Layer1)
def get_closest_region(service="ec2", repetitions=1): """ Get the closest region for a particular service based on its average response time. :type service: str :param service: The service to attempt a connection to. By default, this is ``ec2``. :type repetitions: int :param repetitions: The number of measurements to take before calculating an average. """ regions = [ region.name for region in regioninfo.get_regions(service) if "gov" not in region.name and "cn" not in region.name ] latency = {} for region in regions: connection = Timer( "h.request('GET', '/')", "from http.client import HTTPSConnection; h=HTTPSConnection('%s.%s.amazonaws.com')" % (service, region), ) times = connection.repeat(repetitions, 1) avg_latency = sum(times) / float(len(times)) latency[region] = avg_latency logger.info("Average latency to Amazon %s %s is %s" % (service.upper(), region, latency[region])) region = min(latency, key=latency.get) return region
def regions(): """ Get all available regions for the SNS service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` instances """ return get_regions('sns', connection_cls=SNSConnection)
def regions(): """ Get all available regions for the CloudWatch service. :rtype: list :return: A list of :class:`boto.RegionInfo` instances """ return get_regions('cloudwatch', connection_cls=CloudWatchConnection)
def regions(): """ Get all available regions for the AWS CloudHSM service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.cloudhsm.layer1 import CloudHSMConnection return get_regions('cloudhsm', connection_cls=CloudHSMConnection)
def regions(): """ Get all available regions for the AWS ElastiCache service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.elasticache.layer1 import ElastiCacheConnection return get_regions('elasticache', connection_cls=ElastiCacheConnection)
def regions(): """ Get all available regions for the CloudFormation service. :rtype: list :return: A list of :class:`boto.RegionInfo` instances """ return get_regions("cloudformation", connection_cls=CloudFormationConnection)
def regions(): """ Get all available regions for the AWS Datapipeline service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.datapipeline.layer1 import DataPipelineConnection return get_regions('datapipeline', connection_cls=DataPipelineConnection)
def regions(provider=None): """ Get all available regions for the SNS service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` instances """ return get_regions('sns', connection_cls=SNSConnection, provider=provider)
def regions(): """ Get all available regions for the Amazon Cognito Sync service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.cognito.sync.layer1 import CognitoSyncConnection return get_regions('cognito-sync', connection_cls=CognitoSyncConnection)
def regions(): """ Get all available regions for the AWS Lambda service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.awslambda.layer1 import AWSLambdaConnection return get_regions('awslambda', connection_cls=AWSLambdaConnection)
def regions(): """ Get all available regions for the Amazon CloudSearch service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.cloudsearch2.layer1 import CloudSearchConnection return get_regions('cloudsearch', connection_cls=CloudSearchConnection)
def regions(): """ Get all available regions for the Amazon DynamoDB service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.dynamodb2.layer1 import DynamoDBConnection return get_regions('dynamodb', connection_cls=DynamoDBConnection)
def regions(): """ Get all available regions for the SDB service. :rtype: list :return: A list of :class:`boto.sdb.regioninfo.RegionInfo` instances """ return get_regions('sdb', region_cls=SDBRegionInfo)
def regions(): """ Get all available regions for the AWS Elastic Beanstalk service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.beanstalk.layer1 import Layer1 return get_regions('elasticbeanstalk', connection_cls=Layer1)
def regions(): """ Get all available regions for the Amazon Kinesis service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.kinesis.layer1 import KinesisConnection return get_regions('kinesis', connection_cls=KinesisConnection)
def regions(): """ Get all available regions for the STS service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` instances """ return get_regions('sts', connection_cls=STSConnection)
def regions(provider=None): """ Get all available regions for the STS service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` instances """ return get_regions('sts', connection_cls=STSConnection, provider=provider)
def regions(): """ Get all available regions for the Amazon OpsWorks service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.opsworks.layer1 import OpsWorksConnection return get_regions('opsworks', connection_cls=OpsWorksConnection)
def regions(): """ Get all available regions for the Amazon Glacier service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.glacier.layer2 import Layer2 return get_regions('glacier', connection_cls=Layer2)
def regions(): """ Get all available regions for the Amazon Support service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.support.layer1 import SupportConnection return get_regions('support', connection_cls=SupportConnection)
def regions(): """ Get all available regions for the SQS service. :rtype: list :return: A list of :class:`boto.sqs.regioninfo.RegionInfo` """ return get_regions('sqs', region_cls=SQSRegionInfo)
def regions(): """ Get all available regions for the AWS Redshift service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.redshift.layer1 import RedshiftConnection return get_regions('redshift', connection_cls=RedshiftConnection)
def regions(): """ Get all available regions for the AWS DirectConnect service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.directconnect.layer1 import DirectConnectConnection return get_regions('directconnect', connection_cls=DirectConnectConnection)
def regions(): """ Get all available regions for the AWS CodeDeploy service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.codedeploy.layer1 import CodeDeployConnection return get_regions('codedeploy', connection_cls=CodeDeployConnection)
def regions(): """ Get all available regions for the Amazon EC2 Container Service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.ec2containerservice import EC2ContainerServiceConnection return get_regions('', connection_cls=EC2ContainerServiceConnection)
def regions(): """ Get all available regions for the Amazon Route 53 Domains service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.route53.domains.layer1 import Route53DomainsConnection return get_regions('route53domains', connection_cls=Route53DomainsConnection)
def regions(provider=None): """ Get all available regions for the AWS Cloudtrail service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.cloudtrail.layer1 import CloudTrailConnection return get_regions('cloudtrail', connection_cls=CloudTrailConnection, provider=provider)
def regions(): """ Get all available regions for the AWS Config service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.kms.layer1 import ConfigServiceConnection return get_regions('configservice', connection_cls=ConfigServiceConnection)
def regions(provider=None): """ Get all available regions for the Amazon Support service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.support.layer1 import SupportConnection return get_regions('support', connection_cls=SupportConnection, provider=provider)
def regions(): """ Get all available regions for the CloudWatch Logs service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.logs.layer1 import CloudWatchLogsConnection return get_regions('logs', connection_cls=CloudWatchLogsConnection)
def regions(): """ Get all available regions for the Amazon DynamoDB service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ import boto.dynamodb.layer2 return get_regions('dynamodb', connection_cls=boto.dynamodb.layer2.Layer2)
def regions(provider=None): """ Get all available regions for the AWS ElastiCache service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.elasticache.layer1 import ElastiCacheConnection return get_regions('elasticache', connection_cls=ElastiCacheConnection, provider=provider)
def regions(provider=None): """ Get all available regions for the RDS service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.rds2.layer1 import RDSConnection return get_regions('rds', connection_cls=RDSConnection, provider=provider)