Exemplo n.º 1
0
 def test_connect_to_region(self):
     from boto.awslambda import connect_to_region
     from boto.awslambda.layer1 import AWSLambdaConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, AWSLambdaConnection)
     self.assertEqual(connection.host, 'lambda.us-east-1.amazonaws.com')
Exemplo n.º 2
0
 def test_connect_to_region(self):
     from boto.cloudhsm import connect_to_region
     from boto.cloudhsm.layer1 import CloudHSMConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, CloudHSMConnection)
     self.assertEqual(connection.host, 'cloudhsm.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.configservice import connect_to_region
     from boto.configservice.layer1 import ConfigServiceConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, ConfigServiceConnection)
     self.assertEqual(connection.host, 'config.us-east-1.amazonaws.com')
Exemplo n.º 4
0
 def assert_connection(self, region, host):
     from boto.route53 import connect_to_region
     from boto.route53.connection import Route53Connection
     connection = connect_to_region(region, aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, Route53Connection)
     self.assertEqual(connection.host, host)
Exemplo n.º 5
0
 def test_connect_to_region(self):
     from boto.swf import connect_to_region
     from boto.swf.layer1 import Layer1
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, Layer1)
     self.assertEqual(connection.host, 'swf.us-east-1.amazonaws.com')
Exemplo n.º 6
0
 def test_connect_to_region(self):
     from boto.vpc import connect_to_region
     from boto.vpc import VPCConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, VPCConnection)
     self.assertEqual(connection.host, 'ec2.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.cloudtrail import connect_to_region
     from boto.cloudtrail.layer1 import CloudTrailConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, CloudTrailConnection)
     self.assertEqual(connection.host, 'cloudtrail.us-east-1.amazonaws.com')
Exemplo n.º 8
0
 def test_connect_to_region(self):
     from boto.kinesis import connect_to_region
     from boto.kinesis.layer1 import KinesisConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, KinesisConnection)
     self.assertEqual(connection.host, 'kinesis.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.ec2.cloudwatch import connect_to_region
     from boto.ec2.cloudwatch import CloudWatchConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, CloudWatchConnection)
     self.assertEqual(connection.host, 'monitoring.us-east-1.amazonaws.com')
Exemplo n.º 10
0
 def test_connect_to_region(self):
     from boto.sqs import connect_to_region
     from boto.sqs.connection import SQSConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, SQSConnection)
     self.assertEqual(connection.host, 'queue.amazonaws.com')
 def test_connect_to_region(self):
     from boto.ec2 import connect_to_region
     from boto.ec2.connection import EC2Connection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, EC2Connection)
     self.assertEqual(connection.host, 'ec2.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.dynamodb2 import connect_to_region
     from boto.dynamodb2.layer1 import DynamoDBConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, DynamoDBConnection)
     self.assertEqual(connection.host, 'dynamodb.us-east-1.amazonaws.com')
Exemplo n.º 13
0
 def test_connect_to_region(self):
     from boto.ec2.elb import connect_to_region
     from boto.ec2.elb import ELBConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, ELBConnection)
     self.assertEqual(
         connection.host, 'elasticloadbalancing.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.machinelearning import connect_to_region
     from boto.machinelearning.layer1 import MachineLearningConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, MachineLearningConnection)
     self.assertEqual(
         connection.host, 'machinelearning.us-east-1.amazonaws.com')
Exemplo n.º 15
0
 def test_connect_to_region(self):
     from boto.emr import connect_to_region
     from boto.emr.connection import EmrConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, EmrConnection)
     self.assertEqual(
         connection.host, 'elasticmapreduce.us-east-1.amazonaws.com')
Exemplo n.º 16
0
 def test_connect_to_region(self):
     from boto.cognito.sync import connect_to_region
     from boto.cognito.sync.layer1 import CognitoSyncConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, CognitoSyncConnection)
     self.assertEqual(
         connection.host, 'cognito-sync.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.route53.domains import connect_to_region
     from boto.route53.domains.layer1 import Route53DomainsConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, Route53DomainsConnection)
     self.assertEqual(
         connection.host, 'route53domains.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.ec2.autoscale import connect_to_region
     from boto.ec2.autoscale import AutoScaleConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, AutoScaleConnection)
     self.assertEqual(
         connection.host, 'autoscaling.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.datapipeline import connect_to_region
     from boto.datapipeline.layer1 import DataPipelineConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, DataPipelineConnection)
     self.assertEqual(
         connection.host, 'datapipeline.us-east-1.amazonaws.com')
 def test_connect_to_custom_host(self):
     from boto.s3 import connect_to_region
     from boto.s3.connection import S3Connection
     host = 'mycustomhost.example.com'
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar', host=host)
     self.assertIsInstance(connection, S3Connection)
     self.assertEqual(connection.host, host)
Exemplo n.º 21
0
 def test_connect_to_region(self):
     from boto.ec2containerservice import connect_to_region
     import boto.ec2containerservice.layer1 as layer1
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(
         connection, layer1.EC2ContainerServiceConnection)
     self.assertEqual(connection.host, 'ecs.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.cloudsearchdomain import connect_to_region
     from boto.cloudsearchdomain.layer1 import CloudSearchDomainConnection
     host = 'mycustomdomain.us-east-1.amazonaws.com'
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar', host=host)
     self.assertIsInstance(connection, CloudSearchDomainConnection)
     self.assertEqual(connection.host, host)
 def test_connect_to_region(self):
     from boto.elastictranscoder import connect_to_region
     from boto.elastictranscoder.layer1 import ElasticTranscoderConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, ElasticTranscoderConnection)
     self.assertEqual(
         connection.host, 'elastictranscoder.us-east-1.amazonaws.com')
Exemplo n.º 24
0
 def test_connect_to_region(self):
     from boto.redshift import connect_to_region
     from boto.redshift.layer1 import RedshiftConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, RedshiftConnection)
     self.assertEqual(
         connection.host, 'redshift.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.cognito.identity import connect_to_region
     from boto.cognito.identity.layer1 import CognitoIdentityConnection
     connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, CognitoIdentityConnection)
     self.assertEqual(
         connection.host, 'cognito-identity.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.swf import connect_to_region
     from boto.swf.layer1 import Layer1
     connection = connect_to_region('us-east-1',
                                    aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, Layer1)
     self.assertEqual(connection.host, 'swf.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.redshift import connect_to_region
     from boto.redshift.layer1 import RedshiftConnection
     connection = connect_to_region('us-east-1',
                                    aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, RedshiftConnection)
     self.assertEqual(connection.host, 'redshift.us-east-1.amazonaws.com')
 def assert_connection(self, region, host):
     from boto.route53 import connect_to_region
     from boto.route53.connection import Route53Connection
     connection = connect_to_region(region,
                                    aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, Route53Connection)
     self.assertEqual(connection.host, host)
 def test_connect_to_region(self):
     from boto.opsworks import connect_to_region
     from boto.opsworks.layer1 import OpsWorksConnection
     connection = connect_to_region('us-east-1',
                                    aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, OpsWorksConnection)
     self.assertEqual(connection.host, 'opsworks.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.ec2containerservice import connect_to_region
     import boto.ec2containerservice.layer1 as layer1
     connection = connect_to_region('us-east-1',
                                    aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, layer1.EC2ContainerServiceConnection)
     self.assertEqual(connection.host, 'ecs.us-east-1.amazonaws.com')
 def test_connect_to_region(self):
     from boto.awslambda import connect_to_region
     from boto.awslambda.layer1 import AWSLambdaConnection
     connection = connect_to_region('us-east-1',
                                    aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, AWSLambdaConnection)
     self.assertEqual(connection.host, 'lambda.us-east-1.amazonaws.com')
Exemplo n.º 32
0
 def test_connect_to_unkown_region(self):
     from boto.dynamodb2 import connect_to_region
     from boto.dynamodb2.layer1 import DynamoDBConnection
     os.environ['BOTO_USE_ENDPOINT_HEURISTICS'] = 'True'
     connection = connect_to_region(
         'us-east-45', aws_access_key_id='foo',
         aws_secret_access_key='bar')
     self.assertIsInstance(connection, DynamoDBConnection)
     self.assertEqual(connection.host, 'dynamodb.us-east-45.amazonaws.com')
 def test_connect_to_unkown_region(self):
     from boto.dynamodb2 import connect_to_region
     from boto.dynamodb2.layer1 import DynamoDBConnection
     os.environ['BOTO_USE_ENDPOINT_HEURISTICS'] = 'True'
     connection = connect_to_region('us-east-45',
                                    aws_access_key_id='foo',
                                    aws_secret_access_key='bar')
     self.assertIsInstance(connection, DynamoDBConnection)
     self.assertEqual(connection.host, 'dynamodb.us-east-45.amazonaws.com')
Exemplo n.º 34
0
def upload_function(zipfile, execution_role, funcname, account_id,
                    handler, region="us-west-2"):

    print("Connecting to %s" % region)
    conn = connect_to_region(region, is_secure=True)

    with open(zipfile) as f:
        role_arn = 'arn:aws:iam::%s:role/%s' (account_id, execution_role)


        aws_lambda.upload_function(funcname, f.read(), "python", role_arn,
                                   handler, "event", description=None,
                                   timeout=60, memory_size=128)