CentOSにaws cliをインストールする

公式を参考にします。
LinuxにAWS CLIをインストールする

[vagrant@localhost ~]$ aws –version
-bash: aws: コマンドが見つかりません
[vagrant@localhost ~]$ pip3 –version
pip 18.0 from /home/vagrant/.pyenv/versions/3.5.2/lib/python3.5/site-packages/pip (python 3.5)
[vagrant@localhost ~]$ python3 –version
Python 3.5.2

pip3は入ってます。インストールしていきます。

[vagrant@localhost ~]$ pip3 install awscli –upgrade –user
Installing collected packages: botocore, s3transfer, awscli
Found existing installation: botocore 1.12.86
Uninstalling botocore-1.12.86:
Successfully uninstalled botocore-1.12.86
Found existing installation: s3transfer 0.1.13
Uninstalling s3transfer-0.1.13:
Successfully uninstalled s3transfer-0.1.13
Found existing installation: awscli 1.16.96
Uninstalling awscli-1.16.96:
Successfully uninstalled awscli-1.16.96
Successfully installed awscli-1.16.198 botocore-1.12.188 s3transfer-0.2.1

[vagrant@localhost ~]$ aws –version
-bash: aws: コマンドが見つかりません
successfully installedとなっているのに、なぜ?

[vagrant@localhost ~]$ which aws
/usr/bin/which: no aws in (/home/vagrant/.pyenv/plugins/pyenv-virtualenv/shims:/home/vagrant/.pyenv/shims:/home/vagrant/.pyenv/bin:/home/vagrant/.rbenv/shims:/home/vagrant/.rbenv/bin:/home/vagrant/.nvm/versions/node/v10.7.0/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/vagrant/bin)
[vagrant@localhost ~]$ which python
~/.pyenv/shims/python

なんでだろー、わからん。。

Amazon S3のAWS署名バーション2の廃止

S3の署名バージョン2が廃止になる。

– 以前の AWS リージョンの一部では、Amazon S3 で署名バージョン 4 と署名バージョン 2 がサポート。ただし、署名バージョン 2 は廃止され、署名バージョン 2 の最終サポートは 2019 年 6 月 24 日に終了
https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/dev/UsingAWSSDK.html#UsingAWSSDK-sig2-deprecation

2016年5月以前にリリースされた AWS SDK を使用する場合、次の表に示すように、署名バージョン 4 のリクエストが必要になることがある
AWS CLI

$ aws configure set default.s3.signature_version s3v4
$ aws configure set profile.your_profile_name.s3.signature_version s3v4

Java SDK

System.setProperty(SDKGlobalConfiguration.ENABLE_S3_SIGV4_SYSTEM_PROPERTY, "true");
-Dcom.amazonaws.services.s3.enableV4

JavaScript SDK

var s3 = new AWS.S3({signatureVersion: 'v4'});

PHP SDK

									
$s3 = new S3Client(['signature' => 'v4']);

Python-Boto SDK

[s3] use-sigv4 = True

Ruby SDK

s3 = AWS::S3::Client.new(:s3_signature_version => :v4)
s3 = Aws::S3::Client.new(signature_version: 'v4')

.NET SDK

AWSConfigsS3.UseSignatureVersion4 = true;

つまり、AWS SDKを使っている場合は、バージョンを確認
– AWS SDK for Java v1 →Java 1.11.x あるいは v2 in Q4 2018 にアップグレード。
– AWS SDK for Java v2 ※アップグレード不要
– AWS SDK for .NET v1 →3.1.10 以降にアップグレード
– AWS SDK for .NET v2 →3.1.10 以降にアップグレード
– AWS SDK for .NET v3 ※アップグレード不要
– AWS SDK for JavaScript v1 →主要バージョン V3 in Q3 2019 にアップグレード
– AWS SDK for JavaScript v2 →2.68.0 以降にアップグレード
– AWS SDK for JavaScript v3 →主要バージョン V3 in Q3 2019 にアップグレード
– AWS SDK for PHP v1 →主要バージョン V3 にアップグレード
– AWS SDK for PHP v2 →主要バージョン V3 にアップグレード
– AWS SDK for PHP v3 ※アップグレード不要
– Boto2 →Boto2 v2.49.0 にアップグレード
– Boto3 →1.5.71 (Botocore)、1.4.6 (Boto3) にアップグレード
– AWS CLI →1.11.108 にアップグレード
– AWS CLI v2 ※アップグレード不要
– AWS SDK for Ruby v1 →Ruby V3 にアップグレード
– AWS SDK for Ruby v2 →Ruby V3 にアップグレード
– AWS SDK for Ruby v3 ※アップグレード不要
– Go ※アップグレード不要
– C++ ※アップグレード不要

AWS CommandLine

AWS Command Line Interface(CLI)
Operate AWS on the command line

It seems that you can easily install AWS CLI by using Python pip. AWS-CLI seems to work with Python 2.6.5 or higher or Python 3.3 or higher.
Let’s put aws cli in centos6.

[vagrant@localhost ~]$ python -V
Python 3.5.2

Installation of AWS-CLI
[vagrant@localhost ~]$ pip install awscli –upgrade –user
Collecting awscli
Downloading https://files.pythonhosted.org/packages/25/f2/ae339ba36dc8774b8fb2b7da1b7351ccdedc7af4b2458221e7ac865b4d2d/awscli-1.16.96-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 4.3MB/s
Collecting s3transfer<0.2.0,>=0.1.12 (from awscli)
Downloading https://files.pythonhosted.org/packages/d7/14/2a0004d487464d120c9fb85313a75cd3d71a7506955be458eebfe19a6b1d/s3transfer-0.1.13-py2.py3-none-any.whl (59kB)
100% |████████████████████████████████| 61kB 3.2MB/s
Requirement already satisfied, skipping upgrade: PyYAML<=3.13,>=3.10 in ./.pyenv/versions/3.5.2/lib/python3.5/site-packages (from awscli) (3.13)
Collecting botocore==1.12.86 (from awscli)
Downloading https://files.pythonhosted.org/packages/d7/af/fd9c0f1f0fdc03d3367a56f35093f8b1020ba1a97ead9fa580156895944b/botocore-1.12.86-py2.py3-none-any.whl (5.2MB)
100% |████████████████████████████████| 5.3MB 545kB/s
Collecting rsa<=3.5.0,>=3.1.2 (from awscli)
Downloading https://files.pythonhosted.org/packages/e1/ae/baedc9cb175552e95f3395c43055a6a5e125ae4d48a1d7a924baca83e92e/rsa-3.4.2-py2.py3-none-any.whl (46kB)
100% |████████████████████████████████| 51kB 3.8MB/s
Collecting colorama<=0.3.9,>=0.2.5 (from awscli)
Downloading https://files.pythonhosted.org/packages/db/c8/7dcf9dbcb22429512708fe3a547f8b6101c0d02137acbd892505aee57adf/colorama-0.3.9-py2.py3-none-any.whl
Collecting docutils>=0.10 (from awscli)
Downloading https://files.pythonhosted.org/packages/36/fa/08e9e6e0e3cbd1d362c3bbee8d01d0aedb2155c4ac112b19ef3cae8eed8d/docutils-0.14-py3-none-any.whl (543kB)
100% |████████████████████████████████| 552kB 650kB/s
Requirement already satisfied, skipping upgrade: python-dateutil<3.0.0,>=2.1; python_version >= “2.7” in ./.pyenv/versions/3.5.2/lib/python3.5/site-packages (from botocore==1.12.86->awscli) (2.7.3)
Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.12.86->awscli)
Downloading https://files.pythonhosted.org/packages/b7/31/05c8d001f7f87f0f07289a5fc0fc3832e9a57f2dbd4d3b0fee70e0d51365/jmespath-0.9.3-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.20; python_version >= “3.4” in ./.pyenv/versions/3.5.2/lib/python3.5/site-packages (from botocore==1.12.86->awscli) (1.23)
Collecting pyasn1>=0.1.3 (from rsa<=3.5.0,>=3.1.2->awscli)
Downloading https://files.pythonhosted.org/packages/7b/7c/c9386b82a25115cccf1903441bba3cbadcfae7b678a20167347fa8ded34c/pyasn1-0.4.5-py2.py3-none-any.whl (73kB)
100% |████████████████████████████████| 81kB 2.2MB/s
Requirement already satisfied, skipping upgrade: six>=1.5 in ./.pyenv/versions/3.5.2/lib/python3.5/site-packages (from python-dateutil<3.0.0,>=2.1; python_version >= “2.7”->botocore==1.12.86->awscli) (1.11.0)
Installing collected packages: jmespath, docutils, botocore, s3transfer, pyasn1, rsa, colorama, awscli
The scripts pyrsa-decrypt, pyrsa-decrypt-bigfile, pyrsa-encrypt, pyrsa-encrypt-bigfile, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in ‘/home/vagrant/.local/bin’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use –no-warn-script-location.
Successfully installed awscli-1.16.96 botocore-1.12.86 colorama-0.3.9 docutils-0.14 jmespath-0.9.3 pyasn1-0.4.5 rsa-3.4.2 s3transfer-0.1.13
You are using pip version 18.0, however version 19.0.1 is available.
You should consider upgrading via the ‘pip install –upgrade pip’ command.

[vagrant@localhost ~]$ aws –version
-bash: aws: コマンドが見つかりません

If I just installed it, I have to passed the path because the aws command was not recognized.