def get_ses_connection(args): """Given a set of parsed arguments, returns an SESConnection.""" credentials = parse_aws_credentials_file(args.credentials_file) region = RegionInfo(endpoint=args.host) connection = SESConnection(debug=(2 if args.verbose else 0), **credentials) region.connection = connection return connection
def _connect(self, **kwargs): cloud_config = self._config.plugins[self.full_name] context = self._config.context self._instance_metadata = get_instance_metadata() euca_path = "/services/Eucalyptus" euca_port = 8773 ec2_region = RegionInfo() ec2_region.name = 'eucalyptus' ec2_region.endpoint = context.cloud.ec2_endpoint connection_args = { 'is_secure': False, 'debug': 0, 'port' : 8773, 'path' : euca_path, 'host' : context.cloud.ec2_endpoint, 'api_version': '2012-07-20', 'region': ec2_region } if float(boto.__version__[0:3]) >= 2.6: connection_args['validate_certs'] = False self._connection = boto.connect_ec2(**connection_args) log.info('Aminating in region {0}: http://{1}:{2}{3}'.format(ec2_region.name, context.cloud.ec2_endpoint, euca_port, euca_path))
def connect(region_name): region = RegionInfo( name=region_name, endpoint=RegionData[region_name], connection_cls=_EC2Connection) return region.connect( aws_access_key_id=conf.SMP_ACCESSKEY, aws_secret_access_key=conf.SMP_SECRETKEY)
def regions(): """ Get all available regions for the Amazon Elastic MapReduce service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ return [ RegionInfo(name='us-east-1', endpoint='elasticmapreduce.us-east-1.amazonaws.com', connection_cls=EmrConnection), RegionInfo(name='us-west-1', endpoint='us-west-1.elasticmapreduce.amazonaws.com', connection_cls=EmrConnection), RegionInfo(name='us-west-2', endpoint='us-west-2.elasticmapreduce.amazonaws.com', connection_cls=EmrConnection), RegionInfo(name='ap-northeast-1', endpoint='ap-northeast-1.elasticmapreduce.amazonaws.com', connection_cls=EmrConnection), RegionInfo(name='ap-southeast-1', endpoint='ap-southeast-1.elasticmapreduce.amazonaws.com', connection_cls=EmrConnection), RegionInfo(name='ap-southeast-2', endpoint='ap-southeast-2.elasticmapreduce.amazonaws.com', connection_cls=EmrConnection), RegionInfo(name='eu-west-1', endpoint='eu-west-1.elasticmapreduce.amazonaws.com', connection_cls=EmrConnection), RegionInfo(name='sa-east-1', endpoint='sa-east-1.elasticmapreduce.amazonaws.com', connection_cls=EmrConnection), ]
def regions(): """ Get all available regions for the STS service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` instances """ return [ RegionInfo(name='us-east-1', endpoint='sts.amazonaws.com', connection_cls=STSConnection), RegionInfo(name='us-gov-west-1', endpoint='sts.us-gov-west-1.amazonaws.com', connection_cls=STSConnection) ]
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, is_secure=False, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/'): """ Init method to create a new connection to EC2 Load Balancing Service. .. note:: The region argument is overridden by the region specified in the boto configuration file. """ if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) self.region = region AWSQueryConnection.__init__(self, aws_access_key_id, aws_secret_access_key, is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, self.region.endpoint, debug, https_connection_factory, path)
def handle(self, *args, **options): verbosity = options.get('verbosity', 0) add_email = options.get('add', False) delete_email = options.get('delete', False) list_emails = options.get('list', False) access_key_id = settings.ACCESS_KEY access_key = settings.SECRET_KEY region = RegionInfo(name=settings.AWS_SES_REGION_NAME, endpoint=settings.AWS_SES_REGION_ENDPOINT) connection = SESConnection(aws_access_key_id=access_key_id, aws_secret_access_key=access_key, region=region) if add_email: if verbosity != '0': print("Adding email: " + add_email) connection.verify_email_address(add_email) elif delete_email: if verbosity != '0': print("Removing email: " + delete_email) connection.delete_verified_email_address(delete_email) elif list_emails: if verbosity != '0': print("Fetching list of verified emails:") response = connection.list_verified_email_addresses() emails = response['ListVerifiedEmailAddressesResponse'][ 'ListVerifiedEmailAddressesResult']['VerifiedEmailAddresses'] for email in emails: print(email)
def __init__(self): self.username = os.environ['EC2_ACCESS_KEY'] self.password = os.environ['EC2_SECRET_KEY'] self.iaas_url = os.environ['PHANTOM_URL'] self.domain_name = "my_domain" self.launch_config_name = "my_launch_config" self.vm_image = "hello-phantom.gz" self.max_vms = 4 self.key_name = "phantomkey" self.image_type = "m1.small" self.clouds = ["hotel", "sierra"] # Create our Phantom connection parsed_url = urlparse.urlparse(self.iaas_url) ssl = parsed_url.scheme == "https" host = parsed_url.hostname port = parsed_url.port region = RegionInfo(name="nimbus", endpoint=host) self.connection = boto.ec2.autoscale.AutoScaleConnection( aws_access_key_id=self.username, aws_secret_access_key=self.password, is_secure=ssl, port=port, debug=2, region=region, validate_certs=False) self.connection.host = host self.create_launch_configuration() self.create_domain() self.run_policy()
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', security_token=None): if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) self.region = region AWSAuthConnection.__init__(self, self.region.endpoint, aws_access_key_id, aws_secret_access_key, is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, debug, https_connection_factory, path, security_token=security_token)
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, aws_sudo_id=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', security_token=None, validate_certs=True): """ Init method to create a new connection to EC2 Monitoring Service. B{Note:} The host argument is overridden by the host specified in the boto configuration file. """ if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) self.region = region # Ugly hack to get around both a bug in Python and a # misconfigured SSL cert for the eu-west-1 endpoint if self.region.name == 'eu-west-1': validate_certs = False AWSQueryConnection.__init__(self, aws_access_key_id, aws_secret_access_key, is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, self.region.endpoint, debug, https_connection_factory, path, security_token, validate_certs=validate_certs) self.aws_sudo_id = aws_sudo_id
def __init__(self, fail_silently=False, aws_access_key=None, aws_secret_key=None, aws_region_name=None, aws_region_endpoint=None, aws_auto_throttle=None, dkim_domain=None, dkim_key=None, dkim_selector=None, dkim_headers=None, **kwargs): super(SESBackend, self).__init__(fail_silently=fail_silently, **kwargs) self._access_key_id = aws_access_key or settings.ACCESS_KEY self._access_key = aws_secret_key or settings.SECRET_KEY self._region = RegionInfo(name=aws_region_name or settings.AWS_SES_REGION_NAME, endpoint=aws_region_endpoint or settings.AWS_SES_REGION_ENDPOINT) self._throttle = aws_auto_throttle or settings.AWS_SES_AUTO_THROTTLE self.dkim_domain = dkim_domain or settings.DKIM_DOMAIN self.dkim_key = dkim_key or settings.DKIM_PRIVATE_KEY self.dkim_selector = dkim_selector or settings.DKIM_SELECTOR self.dkim_headers = dkim_headers or settings.DKIM_HEADERS self.connection = None
def __init__(self, ec2_keyname, instance_profile, service_role, subnet_id, region, core_node_limit, impala_docker_repo_base_url, impala_version, cluster_tags, dart_host, dart_port, dart_api_version=1): super(EmrEngine, self).__init__() self._action_handlers = { EmrActionTypes.start_datastore.name: start_datastore, EmrActionTypes.terminate_datastore.name: terminate_datastore, EmrActionTypes.load_dataset.name: load_dataset, EmrActionTypes.consume_subscription.name: consume_subscription, EmrActionTypes.run_hive_script_action.name: run_hive_script, EmrActionTypes.run_impala_script_action.name: run_impala_script, EmrActionTypes.run_pyspark_script_action.name: run_pyspark_script, EmrActionTypes.copy_hdfs_to_s3_action.name: copy_hdfs_to_s3, } self._region = RegionInfo(self, region, 'elasticmapreduce.%s.amazonaws.com' % region) if region else None self._conn = None self.ec2_keyname = ec2_keyname self.core_node_limit = core_node_limit self.instance_profile = instance_profile self.service_role = service_role self.subnet_id = subnet_id self.cluster_tags = cluster_tags self.impala_docker_repo_base_url = impala_docker_repo_base_url self.impala_version = impala_version self.dart = Dart(dart_host, dart_port, dart_api_version)
def setUp(self): self.region = RegionInfo( name='cc-zone-1', endpoint='mockservice.cc-zone-1.amazonaws.com', connection_cls=MockAWSService) HTTPretty.enable()
def test_initialization_regression(self): us_west_2 = RegionInfo(name='us-west-2', endpoint='cloudsearch.us-west-2.amazonaws.com') self.layer2 = Layer2(region=us_west_2, host='cloudsearch.us-west-2.amazonaws.com') self.assertEqual(self.layer2.layer1.host, 'cloudsearch.us-west-2.amazonaws.com')
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', converter=None): if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint, connection_cls=STSConnection) self.region = region self._mutex = threading.Semaphore() AWSQueryConnection.__init__(self, aws_access_key_id, aws_secret_access_key, is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, self.region.endpoint, debug, https_connection_factory, path)
def handle(self, *args, **options): verbosity = options.get('verbosity', 0) add_email = options.get('add', False) delete_email = options.get('delete', False) list_emails = options.get('list', False) access_key_id = getattr(settings, 'AWS_ACCESS_KEY_ID', None) access_key = getattr(settings, 'AWS_SECRET_ACCESS_KEY', None) region = RegionInfo(name=getattr(settings, 'AWS_SES_REGION_NAME', SESConnection.DefaultRegionName), endpoint=getattr( settings, 'AWS_SES_REGION_ENDPOINT', SESConnection.DefaultRegionEndpoint)) connection = SESConnection(aws_access_key_id=access_key_id, aws_secret_access_key=access_key, region=region) if add_email: if verbosity != '0': print "Adding email: %s" % add_email connection.verify_email_address(add_email) elif delete_email: if verbosity != '0': print "Removing email: %s" % delete_email connection.delete_verified_email_address(delete_email) elif list_emails: if verbosity != '0': print "Fetching list of verified emails:" response = connection.list_verified_email_addresses() emails = response['ListVerifiedEmailAddressesResponse'][ 'ListVerifiedEmailAddressesResult']['VerifiedEmailAddresses'] for email in emails: print email
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', security_token=None, validate_certs=True, profile_name=None): """ Init method to create a new connection to the AutoScaling service. B{Note:} The host argument is overridden by the host specified in the boto configuration file. """ if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint, AutoScaleConnection) self.region = region super(AutoScaleConnection, self).__init__(aws_access_key_id, aws_secret_access_key, is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, self.region.endpoint, debug, https_connection_factory, path=path, security_token=security_token, validate_certs=validate_certs, profile_name=profile_name)
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', security_token=None): """ Init method to create a new connection to EC2 Monitoring Service. B{Note:} The host argument is overridden by the host specified in the boto configuration file. """ if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) self.region = region AWSQueryConnection.__init__(self, aws_access_key_id, aws_secret_access_key, is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, self.region.endpoint, debug, https_connection_factory, path, security_token)
def connect_boto_network(host='localhost', port=6543): """Connect to ddbmock launched in *server* mode via boto""" import boto from boto.regioninfo import RegionInfo endpoint = '{}:{}'.format(host,port) region = RegionInfo(name='ddbmock', endpoint=endpoint) return boto.connect_dynamodb(region=region, port=port, is_secure=False)
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', security_token=None, validate_certs=True, profile_name=None): if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) self.region = region super(SESConnection, self).__init__(self.region.endpoint, aws_access_key_id, aws_secret_access_key, is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, debug, https_connection_factory, path, security_token=security_token, validate_certs=validate_certs, profile_name=profile_name)
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', converter=None, validate_certs=True, anon=False, security_token=None, profile_name=None, provider='aws'): """ :type anon: boolean :param anon: If this parameter is True, the ``STSConnection`` object will make anonymous requests, and it will not use AWS Credentials or even search for AWS Credentials to make these requests. """ if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint, connection_cls=STSConnection, provider=provider) self.region = region self.anon = anon self._mutex = threading.Semaphore() # If an anonymous request is sent, do not try to look for credentials. # So we pass in dummy values for the access key id, secret access # key, and session token. It does not matter that they are # not actual values because the request is anonymous. if self.anon: provider = Provider('aws', NO_CREDENTIALS_PROVIDED, NO_CREDENTIALS_PROVIDED, NO_CREDENTIALS_PROVIDED) super(STSConnection, self).__init__(aws_access_key_id, aws_secret_access_key, is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, self.region.endpoint, debug, https_connection_factory, path, validate_certs=validate_certs, security_token=security_token, profile_name=profile_name, provider=provider)
def test_non_aws_region(self): self.ec2 = boto.ec2.connect_to_region( 'foo', https_connection_factory=self.https_connection_factory, aws_access_key_id='aws_access_key_id', aws_secret_access_key='aws_secret_access_key', region=RegionInfo(name='foo', endpoint='https://foo.com/bar')) self.assertEqual('https://foo.com/bar', self.ec2.host)
def __init__(self, **kwargs): region = kwargs.get('region') if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) kwargs['host'] = region.endpoint AWSQueryConnection.__init__(self, **kwargs) self.region = region
def __init__(self, **kwargs): region = kwargs.pop('region', None) if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) kwargs['host'] = region.endpoint super(SupportConnection, self).__init__(**kwargs) self.region = region
def __init__(self, **kwargs): region = kwargs.get('region') if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) kwargs['host'] = region.endpoint super(DataPipelineConnection, self).__init__(**kwargs) self.region = region
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 cls = RedshiftConnection return [ RegionInfo(name='us-east-1', endpoint='redshift.us-east-1.amazonaws.com', connection_cls=cls), RegionInfo(name='us-west-2', endpoint='redshift.us-west-2.amazonaws.com', connection_cls=cls), ]
def regions(): """ 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 [ RegionInfo(name='us-east-1', endpoint='cloudtrail.us-east-1.amazonaws.com', connection_cls=CloudTrailConnection), RegionInfo(name='us-west-2', endpoint='cloudtrail.us-west-2.amazonaws.com', connection_cls=CloudTrailConnection), ]
def regions(): """ Get all available regions for the SNS service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` instances """ return [ RegionInfo(name='us-east-1', endpoint='sns.us-east-1.amazonaws.com', connection_cls=SNSConnection), RegionInfo(name='eu-west-1', endpoint='sns.eu-west-1.amazonaws.com', connection_cls=SNSConnection), RegionInfo(name='us-west-1', endpoint='sns.us-west-1.amazonaws.com', connection_cls=SNSConnection), RegionInfo(name='sa-east-1', endpoint='sns.sa-east-1.amazonaws.com', connection_cls=SNSConnection), RegionInfo(name='us-west-2', endpoint='sns.us-west-2.amazonaws.com', connection_cls=SNSConnection), RegionInfo(name='ap-northeast-1', endpoint='sns.ap-northeast-1.amazonaws.com', connection_cls=SNSConnection), RegionInfo(name='ap-southeast-1', endpoint='sns.ap-southeast-1.amazonaws.com', connection_cls=SNSConnection), ]
def _get_region_info(self, host=None, endpoint=None, region_name=None): self.log.debug("get region info params: host:{0}, endpoint:{1}, " "region_name:{2}".format(host, endpoint, region_name)) if (host or endpoint or region_name): region = RegionInfo() if region_name: region.name = region_name self.log.debug("Check region: " + str(region)) try: if not endpoint: endpoint_url = AWSRegionData[region_name] if self.SERVICE_PREFIX and \ not(endpoint_url.startswith(self.SERVICE_PREFIX)): endpoint_url = "{0}.{1}".format(self.SERVICE_PREFIX, endpoint_url) region.endpoint = endpoint_url else: region.endpoint = endpoint except KeyError: raise Exception('Unknown region: %s' % region) else: region.name = host or endpoint if endpoint: region.endpoint = endpoint elif host: region.endpoint = host return region return None
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 [ RegionInfo(name='us-east-1', endpoint='dynamodb.us-east-1.amazonaws.com', connection_cls=boto.dynamodb.layer2.Layer2), RegionInfo(name='us-west-1', endpoint='dynamodb.us-west-1.amazonaws.com', connection_cls=boto.dynamodb.layer2.Layer2), RegionInfo(name='us-west-2', endpoint='dynamodb.us-west-2.amazonaws.com', connection_cls=boto.dynamodb.layer2.Layer2), RegionInfo(name='ap-northeast-1', endpoint='dynamodb.ap-northeast-1.amazonaws.com', connection_cls=boto.dynamodb.layer2.Layer2), RegionInfo(name='ap-southeast-1', endpoint='dynamodb.ap-southeast-1.amazonaws.com', connection_cls=boto.dynamodb.layer2.Layer2), RegionInfo(name='ap-southeast-2', endpoint='dynamodb.ap-southeast-2.amazonaws.com', connection_cls=boto.dynamodb.layer2.Layer2), RegionInfo(name='eu-west-1', endpoint='dynamodb.eu-west-1.amazonaws.com', connection_cls=boto.dynamodb.layer2.Layer2), ]
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 [RegionInfo(name='us-east-1', endpoint='elasticache.us-east-1.amazonaws.com', connection_cls=ElastiCacheConnection), RegionInfo(name='us-west-1', endpoint='elasticache.us-west-1.amazonaws.com', connection_cls=ElastiCacheConnection), RegionInfo(name='us-west-2', endpoint='elasticache.us-west-2.amazonaws.com', connection_cls=ElastiCacheConnection), RegionInfo(name='eu-west-1', endpoint='elasticache.eu-west-1.amazonaws.com', connection_cls=ElastiCacheConnection), RegionInfo(name='ap-northeast-1', endpoint='elasticache.ap-northeast-1.amazonaws.com', connection_cls=ElastiCacheConnection), RegionInfo(name='ap-southeast-1', endpoint='elasticache.ap-southeast-1.amazonaws.com', connection_cls=ElastiCacheConnection), RegionInfo(name='sa-east-1', endpoint='elasticache.sa-east-1.amazonaws.com', connection_cls=ElastiCacheConnection), ]
def __init__(self, **kwargs): region = kwargs.pop('region', None) if not region: region = RegionInfo(self, self.DefaultRegionName, self.DefaultRegionEndpoint) if 'host' not in kwargs: kwargs['host'] = region.endpoint AWSQueryConnection.__init__(self, **kwargs) self.region = region
def _get_elasticache_connection(self): """Get an elasticache connection""" try: endpoint = "elasticache.%s.amazonaws.com" % self.region connect_region = RegionInfo(name=self.region, endpoint=endpoint) return ElastiCacheConnection(region=connect_region, **self.aws_connect_kwargs) except boto.exception.NoAuthHandlerFound, e: self.module.fail_json(msg=e.message)
def dashboard(request): """ Graph SES send statistics over time. """ cache_key = 'vhash:django_ses_stats' cached_view = cache.get(cache_key) if cached_view: return cached_view region = RegionInfo(name=getattr(settings, 'AWS_SES_REGION_NAME', SESConnection.DefaultRegionName), endpoint=getattr(settings, 'AWS_SES_REGION_ENDPOINT', SESConnection.DefaultRegionEndpoint)) ses_conn = SESConnection( aws_access_key_id=getattr(settings, 'AWS_ACCESS_KEY_ID', None), aws_secret_access_key=getattr(settings, 'AWS_SECRET_ACCESS_KEY', None), region=region) quota_dict = ses_conn.get_send_quota() verified_emails_dict = ses_conn.list_verified_email_addresses() stats = ses_conn.get_send_statistics() quota = quota_parse(quota_dict) verified_emails = emails_parse(verified_emails_dict) ordered_data = stats_to_list(stats) summary = sum_stats(ordered_data) extra_context = { 'title': 'SES Statistics', 'datapoints': ordered_data, '24hour_quota': quota['Max24HourSend'], '24hour_sent': quota['SentLast24Hours'], '24hour_remaining': float(quota['Max24HourSend']) - float(quota['SentLast24Hours']), 'persecond_rate': quota['MaxSendRate'], 'verified_emails': verified_emails, 'summary': summary, 'access_key': ses_conn.gs_access_key_id, 'local_time': True if pytz else False, } response = render_to_response('django_ses/send_stats.html', extra_context, context_instance=RequestContext(request)) cache.set(cache_key, response, 60 * 15) # Cache for 15 minutes return response
def connect_to_region(region_name, **kw_params): if ':' in region_name: rlist = region_name.split(':') host = rlist[1] if len(rlist) > 2: port = int(rlist[2]) else: port = 4567 awskey = kw_params.get('aws_access_key', 'UNKNOWN') awssecret = kw_params.get('aws_secret_access_key', 'UNKNOWN') token = AuthToken(awskey, awssecret, 'dummy') r = RegionInfo(name=region_name, endpoint='%s:%d' % (host, port), connection_cls=layer2.Layer2) l = r.connect(aws_access_key_id=awskey, aws_secret_access_key=awssecret, is_secure=False, port=port, session_token=token) return l for region in regions(): if region.name == region_name: return region.connect(**kw_params) return None
def __init__(self, connection=None, name=None, endpoint=None): from boto.sqs.connection import SQSConnection RegionInfo.__init__(self, connection, name, endpoint, SQSConnection)
# There are a few variables to set specific to your environment # endpoint # aws_access_key_id # aws_secret_access_key # KeyName # AMI # import boto from boto.regioninfo import RegionInfo from troposphere import Base64, FindInMap, GetAtt from troposphere import Parameter, Ref, Template import troposphere.ec2 as ec2 region = RegionInfo() region.endpoint = "CLC IP" region.name = "eucalyptus" stack_name = "test-stack-1" tester = boto.connect_cloudformation(region=region, port=8773, path="/services/CloudFormation", is_secure=False, aws_access_key_id="your access key", aws_secret_access_key="your secret key") template = Template() keyname_param = template.add_parameter(Parameter("KeyName", Description="Name of an existing EC2 KeyPair to enable SSH access to the instance", Type="String", )) template.add_mapping('RegionMap', {"": {"AMI": "emi to use"}})
def __init__(self, connection=None, name=None, endpoint=None): from boto.ec2.connection import EC2Connection RegionInfo.__init__(self, connection, name, endpoint, EC2Connection)
def __init__(self, connection=None, name=None, endpoint=None): from boto.rds import RDSConnection RegionInfo.__init__(self, connection, name, endpoint, RDSConnection)