def connect_ec2_endpoint(url, aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
 from boto.ec2.regioninfo import RegionInfo
 purl = urlparse(url)
 kwargs['port'] = purl.port
 kwargs['host'] = purl.hostname
 kwargs['path'] = purl.path
 if (not ('is_secure' in kwargs)):
  kwargs['is_secure'] = (purl.scheme == 'https')
 kwargs['region'] = RegionInfo(name=purl.hostname, endpoint=purl.hostname)
 kwargs['aws_access_key_id'] = aws_access_key_id
 kwargs['aws_secret_access_key'] = aws_secret_access_key
 return connect_ec2(**kwargs)

def connect_ec2_endpoint ( url , aws_access_key_id = None , aws_secret_access_key = None , ** kwargs ) : from boto . ec2 . regioninfo import RegionInfo purl = urlparse ( url ) kwargs [ 'port' ] = purl . port kwargs [ 'host' ] = purl . hostname kwargs [ 'path' ] = purl . path if ( not ( 'is_secure' in kwargs ) ) : kwargs [ 'is_secure' ] = ( purl . scheme == 'https' ) kwargs [ 'region' ] = RegionInfo ( name = purl . hostname , endpoint = purl . hostname ) kwargs [ 'aws_access_key_id' ] = aws_access_key_id kwargs [ 'aws_secret_access_key' ] = aws_secret_access_key return connect_ec2 ( ** kwargs )
connect to an ec2 api endpoint .