presents by IT Consulting 109

AWS CIL – インストール

概要


AWSで使用するコマンドラインインターフェイスの導入について記載しています。
今後紹介するAWS関連のコマンドを使用する上で必要となりますので導入する事をお勧めします。

参照:AWS コマンドラインインターフェイス

 

手順


  • AWS CLIのインストール
  • IAMのユーザー作成
  • AWS CLIの設定

 

 

AWS CLI のインストール

1.pip のウェブサイトからインストールスクリプトをダウンロードし実行します。

次のコマンドを実行。

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

実行結果

#

※エラーが表示されていなければ成功です。

 

2.pip を使用して AWS CLI をインストールします。

次のコマンドを実行。

sudo pip install awscli

実行結果

#

※エラーが表示されていなければ成功です。

 

3.コマンドがインストールされていることを確認します。

次のコマンドを実行。

aws help

実行結果

AWS()                                                                    AWS()



NAME
       aws -

DESCRIPTION
       The  AWS  Command  Line  Interface is a unified tool to manage your AWS services.

SYNOPSIS
          aws [options]   [parameters]

       Use aws command help for information on a  specific  command.  Use  aws help  topics  to view a list of available help topics. The synopsis for each command shows its parameters and their usage. Optional  parameters are shown in square brackets.

OPTIONS
       --debug (boolean)

       Turn on debug logging.

       --endpoint-url (string)

       Override command's default URL with the given URL.

       --no-verify-ssl (boolean)

       By  default, the AWS CLI uses SSL when communicating with AWS services.
       For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

       --no-paginate (boolean)

       Disable automatic pagination.

       --output (string)

       The formatting style for command output.

       o json

       o text

:

※ヘルプの内容が表示されていれば成功です。

 

AWS CLIのバージョン確認

次のコマンドを実行。

aws --version

実行結果

aws-cli/1.11.169 Python/2.7.5 Linux/3.10.0-693.2.2.el7.x86_64 botocore/1.7.27

※aws-cli/1.11.169 であることが確認できました。

 

 

IAMのユーザー作成

AWS – AWS CLI用IAMユーザ作成を参考にしてIAMユーザーを作成します。

 

 

AWS CLI の設定

1.aws configure コマンド、AWS CLI のインストールをセットアップします。 
※例としてログしているユーザー(ec2-userなど)とIAMユーザーを紐付けます。

次のコマンドを実行する。

aws configure

次の入力値を求められます。

AWS Access Key ID [None]: ※1
AWS Secret Access Key [None]: ※2
Default region name [None]: ※3
Default output format [None]: json

※1 IAMユーザーのAccess key ID

※2 IAMユーザーのSercret Access key ID

※3 日本なら「 ap-northeast-1 」を設定

※4 フォーマットとして「json」「text」「table」のいずれかを設定

この記事を書いた人
名前:TRUE's。 千葉県育ち、神奈川県在住のIT系フリーエンジニア。 IT系のナレッジサイトを不定期で更新中。 フォトグラファー兼エンジニアとして日々勤しんでいる。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です