AWS CLI のインストールと基本設定
▼Max OS X の場合
$ sudo brew install python
$ sudo easy_install pip
$ sudo pip install awscli
▼Linux (Cent OS 系) の場合
$ sudo yum install python-setuptools
$ sudo easy_install pip
$ sudo pip install awscli
▼Windows の場合
https://s3.amazonaws.com/aws-cli/AWSCLI64.msi
https://s3.amazonaws.com/aws-cli/AWSCLI32.msi
をダウンロードして実行
2) AWS CLI の基本操作
▼ version 確認(例)
$ aws --version
aws-cli/1.10.4 Python/2.7.9 Windows/7 botocore/1.3.26
▼基本設定
$ aws configure
AWS Access Key ID, AWS Secret Access Key, Region, format を入力
※mintty 上で実行したらプロンプトが返ってこないため、仕方なくコマンドプロンプトから実行した。
AWS Access Key ID [None] : *************************
AWS Secret Access Key [None] : ***********************
Default region name [None] : ap-northeast-1 ←東京リージョンはこれ
Default output format [None] : text ← text, json, table のいずれか
▼設定確認
$ aws ec2 describe-security-groups
SECURITYGROUPS や IPPERMISSIONS, USERIDGROUPPAIRS他情報が
表示される。
別の設定を保存することもできる。
$ aws configure -- profile user-1
別で設定した profile でコマンドを実行する場合は、実行時に --profile オプションで指定した profile を指定する
$ aws ec2 describe-security-groups --profile user-1
▼設定ファイルの保存場所
設定ファイルは以下の場所に保存される
~/.aws/ 配下
Windows の場合は、
%USERPROFILE%\.aws 配下
よって、
c: \> cd %USERPROFILE%\.aws
で設定ファイル保存場所に移動できる。