LoginSignup
60
63

More than 5 years have passed since last update.

AWS CLIのインストール

Last updated at Posted at 2017-05-02

AWS CLIのインストールのメモ

Windows

MSIインストーラのダウンロード & 実行

Linux、Unix or macOS

ダウンロード

コマンド
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
sudo python get-pip.py

Linux、Unix

コマンド
sudo pip install awscli

macOS

コマンド
#sixのアップグレード無視
sudo pip install awscli --upgrade --ignore-installed six

AWS CLI設定

aws configure実行

コマンド
aws configure
設定
AWS Access Key ID [None]: *************ID
AWS Secret Access Key [None]: ******************************KEY
Default region name [None]: ap-northeast-1
Default output format [None]: json

一時設定変更

  • Linux、Unix or macOS
コマンド
export AWS_ACCESS_KEY_ID=*************ID
export AWS_SECRET_ACCESS_KEY=******************************KEY
export AWS_DEFAULT_REGION=ap-northeast-1
export AWS_DEFAULT_OUTPUT=json
  • Windows
コマンド
set AWS_ACCESS_KEY_ID=*************ID
set AWS_SECRET_ACCESS_KEY=******************************KEY
set AWS_DEFAULT_REGION=ap-northeast-1
set AWS_DEFAULT_OUTPUT=json

設定確認

コマンド
aws configure list
結果
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key     ****************VNPA              env    
secret_key     ****************dSZJ              env    
    region           ap-northeast-1              env    AWS_DEFAULT_REGION

awscliのversionアップグレード

Windows

最新版のインストーラーをダウンロードし再インストールする。

Linux、Unix、macOS

コマンド
sudo pip install -U awscli

コマンド補完を有効にする

Linux、Unix、macOS(Unix似)のみ

 AWSコンプリータを見つける

whichで見つける
which aws_completer
findで見つける
find / -name aws_completer 2> /dev/null
結果
/usr/local/bin/aws_completer

 補完を有効にする。~/.bash_profileファイルの行末に追加すると便利

bashシェル
complete -C '/usr/local/bin/aws_completer' aws

 補完の確認

確認
aws ec2 describe-i <-ここでtab

下記のように出力される

結果
describe-iam-instance-profile-associations   describe-images                              describe-instance-credit-specifications 
describe-id-format                           describe-import-image-tasks                  describe-instance-status 
describe-identity-id-format                  describe-import-snapshot-tasks               describe-instances 
describe-image-attribute                     describe-instance-attribute                  describe-internet-gateways

以上。

60
63
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
60
63