File: test_connect_to_region.py

package info (click to toggle)
python-boto 2.49.0-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,888 kB
  • sloc: python: 86,396; makefile: 112
file content (519 lines) | stat: -rw-r--r-- 24,173 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# Copyright (c) 2017 Amazon.com, Inc. or its affiliates.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# tribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the fol-
# lowing conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
import os

from tests.unit import unittest


class TestConnectAwslambda(unittest.TestCase):
    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')


class TestConnectBeanstalk(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.beanstalk import connect_to_region
        from boto.beanstalk.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, 'elasticbeanstalk.us-east-1.amazonaws.com')


class TestConnectCloudformation(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.cloudformation import connect_to_region
        from boto.cloudformation.connection import CloudFormationConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, CloudFormationConnection)
        self.assertEqual(
            connection.host, 'cloudformation.us-east-1.amazonaws.com')


class TestConnectCloudHsm(unittest.TestCase):
    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')


class TestCloudsearchConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.cloudsearch import connect_to_region
        from boto.cloudsearch.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, 'cloudsearch.us-east-1.amazonaws.com')


class TestCloudsearch2Connection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.cloudsearch2 import connect_to_region
        from boto.cloudsearch2.layer1 import CloudSearchConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, CloudSearchConnection)
        self.assertEqual(
            connection.host, 'cloudsearch.us-east-1.amazonaws.com')


class TestCloudsearchDomainConnection(unittest.TestCase):
    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)


class TestCloudTrailConnection(unittest.TestCase):
    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')


class TestCodeDeployConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.codedeploy import connect_to_region
        from boto.codedeploy.layer1 import CodeDeployConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, CodeDeployConnection)
        self.assertEqual(connection.host, 'codedeploy.us-east-1.amazonaws.com')


class TestCognitoIdentityConnection(unittest.TestCase):
    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')


class TestCognitoSyncConnection(unittest.TestCase):
    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')


class TestConfigserviceConnection(unittest.TestCase):
    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')


class TestDatapipelineConnection(unittest.TestCase):
    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')


class TestDirectconnectConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.directconnect import connect_to_region
        from boto.directconnect.layer1 import DirectConnectConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, DirectConnectConnection)
        self.assertEqual(
            connection.host, 'directconnect.us-east-1.amazonaws.com')


class TestDynamodbConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.dynamodb import connect_to_region
        from boto.dynamodb.layer2 import Layer2
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, Layer2)
        self.assertEqual(
            connection.layer1.host, 'dynamodb.us-east-1.amazonaws.com')


class TestDynamodb2Connection(unittest.TestCase):
    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')

    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')


class TestEC2Connection(unittest.TestCase):
    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')


class TestAutoscaleConnection(unittest.TestCase):
    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')


class TestCloudwatchConnection(unittest.TestCase):
    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')


class TestElbConnection(unittest.TestCase):
    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')


class TestEc2ContainerserviceConnection(unittest.TestCase):
    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')


class TestElasticacheConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.elasticache import connect_to_region
        from boto.elasticache.layer1 import ElastiCacheConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, ElastiCacheConnection)
        self.assertEqual(
            connection.host, 'elasticache.us-east-1.amazonaws.com')


class TestElastictranscoderConnection(unittest.TestCase):
    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')


class TestEmrConnection(unittest.TestCase):
    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')


class TestGlacierConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.glacier import connect_to_region
        from boto.glacier.layer2 import Layer2
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, Layer2)
        self.assertEqual(
            connection.layer1.host, 'glacier.us-east-1.amazonaws.com')


class TestIamConnection(unittest.TestCase):
    def assert_connection(self, region, host):
        from boto.iam import connect_to_region
        from boto.iam.connection import IAMConnection
        connection = connect_to_region(region, aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, IAMConnection)
        self.assertEqual(connection.host, host)

    def test_connect_to_region(self):
        self.assert_connection('us-east-1', 'iam.amazonaws.com')

    def test_connect_to_universal_region(self):
        self.assert_connection('universal', 'iam.amazonaws.com')


class TestKinesisConnection(unittest.TestCase):
    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')


class TestLogsConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.logs import connect_to_region
        from boto.logs.layer1 import CloudWatchLogsConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, CloudWatchLogsConnection)
        self.assertEqual(
            connection.host, 'logs.us-east-1.amazonaws.com')


class TestMachinelearningConnection(unittest.TestCase):
    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')


class TestOpsworksConnection(unittest.TestCase):
    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')


class TestRdsConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.rds import connect_to_region
        from boto.rds import RDSConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, RDSConnection)
        self.assertEqual(
            connection.host, 'rds.amazonaws.com')


class TestRds2Connection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.rds2 import connect_to_region
        from boto.rds2.layer1 import RDSConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, RDSConnection)
        self.assertEqual(
            connection.host, 'rds.amazonaws.com')


class TestRedshiftConnection(unittest.TestCase):
    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')


class TestRoute53Connection(unittest.TestCase):
    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):
        self.assert_connection('us-east-1', 'route53.amazonaws.com')

    def test_connect_to_universal_region(self):
        self.assert_connection('universal', 'route53.amazonaws.com')


class TestRoute53DomainsConnection(unittest.TestCase):
    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')


class TestS3Connection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.s3 import connect_to_region
        from boto.s3.connection import S3Connection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, S3Connection)
        self.assertEqual(connection.host, 's3.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)


class TestSdbConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.sdb import connect_to_region
        from boto.sdb.connection import SDBConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, SDBConnection)
        self.assertEqual(connection.host, 'sdb.amazonaws.com')


class TestSesConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.ses import connect_to_region
        from boto.ses.connection import SESConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, SESConnection)
        self.assertEqual(connection.host, 'email.us-east-1.amazonaws.com')


class TestSnsConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.sns import connect_to_region
        from boto.sns.connection import SNSConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, SNSConnection)
        self.assertEqual(connection.host, 'sns.us-east-1.amazonaws.com')


class TestSqsConnection(unittest.TestCase):
    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')


class TestStsConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.sts import connect_to_region
        from boto.sts.connection import STSConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, STSConnection)
        self.assertEqual(connection.host, 'sts.amazonaws.com')


class TestSupportConnection(unittest.TestCase):
    def test_connect_to_region(self):
        from boto.support import connect_to_region
        from boto.support.layer1 import SupportConnection
        connection = connect_to_region('us-east-1', aws_access_key_id='foo',
                                       aws_secret_access_key='bar')
        self.assertIsInstance(connection, SupportConnection)
        self.assertEqual(connection.host, 'support.us-east-1.amazonaws.com')


class TestSwfConnection(unittest.TestCase):
    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')


class TestVpcConnection(unittest.TestCase):
    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')