LoginSignup
3
3

More than 5 years have passed since last update.

botoでのリージョン指定

Posted at

コネクション張る時のリージョン指定の方法が良くわからなかったのでメモ。
というか、調べて出てきたのが上手く動かなかったので。。。

  • AWS APIへbotoからアクセスするよ。
  • boto のインストール方法は Google さんへ。
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()

リージョンとエンドポイントはこちら

これだけでのようで御座います。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3