CentOS/UbuntuにAWSCLI(AWSコマンドライン)をインストールする

linux_logo

この記事には広告を含む場合があります。

記事内で紹介する商品を購入することで、当サイトに売り上げの一部が還元されることがあります。

awscli を EC2 インスタンスにインストールする

EC2 にて AWS の各サービスと連携を行うためのコマンドラインである awscli をインストールする手順をまとめていきます。

awscli がインストール済みであるかを確認するときは、バージョン情報を得るコマンドを実行してください。もしバージョン情報が返ってきたら既にインストール済みであるため対応は必要ありません。

aws aws –versionversion

 

Centos7 に awscli をインストールする

ではまずは CentOS7 にインストールする手順をまとめていきます。

実行するコマンドラインは4つ。awscli は python を使用しているため、python をインストールしてから awscli をインストールする必要があります。

実行するコマンド一覧

yum install -y epel-release
yum install -y python-pip
pip install pip –upgrade
pip install awscli

Centos7 に awscli をインストールしたときの実行結果

[root@example]# yum install -y epel-release
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
(中略)
Installed:
  epel-release.noarch 0:7-11

Complete!
[root@example]# yum install -y python-pip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink
(中略)
Installed:
  python2-pip.noarch 0:8.1.2-10.el7

Complete!
[root@example]# pip install pip --upgrade
Collecting pip
  Downloading https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl (1.4MB)
(中略)
      Successfully uninstalled pip-8.1.2
Successfully installed pip-19.2.3
[root@example]# pip install awscli
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting awscli
(中略)
      Successfully uninstalled urllib3-1.10.2
Successfully installed awscli-1.16.242 botocore-1.12.232 colorama-0.3.9 docutils-0.15.2 futures-3.3.0 jmespath-0.9.4 pyasn1-0.4.7 python-dateutil-2.8.0 rsa-3.4.2 s3transfer-0.2.1 urllib3-1.25.5

 

Ubuntu 18.04 に awscli をインストールする

ubuntu に awscli をインストールするコマンドは1つ。いつも通り apt コマンドでインストールすることができます。

実行するコマンド

apt install awscli

buntu 18.04 に awscli をインストールしたときの実行結果

root@example:# apt install awscli
Reading package lists... Done
Building dependency tree       
Reading state information... Done
(中略)

 

 

Linuxの知識については下記の本も参考になるので、スキルアップにお役立てください。

created by Rinker
三宅 英明 (著)、大角 祐介 (著)
ページ数: 440ページ
出版社:SBクリエイティブ
発売日:2015/06/06

出典:amazon