[PYTHON] Region specification with boto

I didn't know how to specify the region when making a connection, so make a note. Or rather, I looked it up and it didn't work. .. ..

connection.py


#!/usr/bin/python 
# coding: utf8

from boto.ec2 import EC2Connection

# defaults region
EC2Connection.DefaultRegionName		= 'ap-northeast-1'
EC2Connection.DefaultRegionEndpoint	= 'ec2.ap-northeast-1.amazonaws.com'

conn = EC2Connection(
	aws_access_key_id		= 'XXXXXXXXXXXX',
	aws_secret_access_key	= 'YYYYYYYYYYY')

print conn.get_all_instances()

Click here for regions and endpoints (http://docs.amazonwebservices.com/general/latest/gr/rande.html)

It seems that this is all.

Recommended Posts

Region specification with boto
Tested with boto3 + mock
S3 uploader with boto
Set connection timeout with boto3
S3 operation with python boto3
Change retry settings with boto3
Get AWS account ID with boto3
Multi-line size specification reading with python
Connect to Elastic MQ with boto
Use boto3 to mess with S3
Generate S3 signed URL with boto
Try server-side encryption on S3 with boto3
Getting started with Dynamo from Python boto
[AWS] Link Lambda and S3 with boto3
S3 server-side encryption SSE with Python boto3