19
20

More than 5 years have passed since last update.

AWSのRegionを東京に固定する

Posted at

参考: http://d.hatena.ne.jp/rx7/20100612/p1

全世界にあるregionのうちTOKYO(ap-northeast-1)しか使ってないのに、いちいちコマンドで--regionを指定するのは面倒だ。

$ ec2-describe-regions
REGION  eu-west-1       ec2.eu-west-1.amazonaws.com
REGION  sa-east-1       ec2.sa-east-1.amazonaws.com
REGION  us-east-1       ec2.us-east-1.amazonaws.com
REGION  ap-northeast-1  ec2.ap-northeast-1.amazonaws.com
REGION  us-west-2       ec2.us-west-2.amazonaws.com
REGION  us-west-1       ec2.us-west-1.amazonaws.com
REGION  ap-southeast-1  ec2.ap-southeast-1.amazonaws.com

.bashrcとか.bash_profileあたりに以下の指定を追加する。

~/.bashrc
AWS_CREDENTIAL_FILE=/path/to/the/credential-file;  export AWS_CREDENTIAL_FILE
EC2_PRIVATE_KEY=pk-xxxxxxxxxx.pem;                 export EC2_PRIVATE_KEY
EC2_CERT=cert-xxxxxxxxxxxxxxx.pem;                 export EC2_CERT
+EC2_URL=https://ec2.ap-northeast-1.amazonaws.com; export EC2_URL
+EC2_REGION=ap-northeast-1;                        export EC2_REGION

EC2_URLとEC2_REGION。

19
20
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
19
20