LoginSignup
4
5

More than 3 years have passed since last update.

【#awscli】管理者権限を持たないWindows環境に「AWSコマンドラインインターフェイス(aws-cli)」をインストールする #AWS #jawsug #環境構築 #環境設定

Last updated at Posted at 2019-07-19

「AWSコマンドラインインターフェイス(AWS CLI v2)」をインストールする際は ↓ こちらを参照ください

【#awscli】管理者権限を持たないWindows環境に「AWSコマンドラインインターフェイス(AWS CLI v2)」をインストールする #AWS #awscliv2 #jawsug #環境構築 #環境設定
https://qiita.com/kukita/items/56d5f75fb79ff57ff291


管理者権限を持たないWindows端末に「AWSコマンドラインインターフェイス(aws-cli)」をインストールした際の内容を自分用のメモとしてまとめました。

環境情報

OS/ソフトウェア バージョン 入手元
Windows 10 pro バージョン1803(April 2018 Update) Microsoft Corporation
Python3 3.7.4 https://www.python.org/downloads/windows/
pip 19.1.1
aws-cli 1.16.200 https://docs.aws.amazon.com/ja_jp/cli/latest/userguide/install-windows.html

□手順 1: 公式URLからPythonのexecutable installerをダウンロードします

■URL
https://www.python.org/downloads/windows/

■ファイル名
python-3.7.4-amd64.exe

□手順 2: ダウンロードしたexecutable installerを実行します

□手順 3: Add Python 3.7 to PATHチェックボックスにチェックを入れた後Customize installationをクリックします

capture_002_23072019_013335.jpg

□手順 4: 全ての Optional Features にチェックを入れてNextボタンをクリックします

capture_003_23072019_013415.jpg

□手順 5: 次の Advanced Options にチェックを入れてInstallボタンをクリックします

  • Create shortcuts for installed applications
  • Add Python to environment variables
  • Precompile standard library

capture_004_23072019_013508.jpg

□手順 6: Closeボタンをクリックしexecutable installerを終了します

capture_005_23072019_013724.jpg

□手順 7: スタートメニューからPowershellを起動し次のコマンドを実行、Pythonがインストールされて、パスが通っていることを確認します

PS C:\> & python --version
Ptyhon 3.7.4

□手順 8: pipを最新バージョンにアップグレードします

PS C:\> & easy_install.exe -U pip

□手順 9: pipを使ってawscliを依存モジュールと合わせてインストールします

PS C:\> & pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org awscli

私の環境では--trusted-hostオプションを付与せずに実行すると次のエラーメッセージが出力されてしまいました

PS C:\> & pip install awscli
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)'))': /simple/pyyaml/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)'))': /simple/pyyaml/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)'))': /simple/pyyaml/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)'))': /simple/pyyaml/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)'))': /simple/pyyaml/
Could not fetch URL https://pypi.org/simple/pyyaml/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pyyaml/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)'))) - skipping
ERROR: Could not find a version that satisfies the requirement PyYAML<=5.1,>=3.10 (from awscli) (from versions: none)
ERROR: No matching distribution found for PyYAML<=5.1,>=3.10 (from awscli)

□手順 10: aws --versionコマンドを実行してaws-cliが正常にインストールされたことを確認します

PS C:\> & aws --version
拡張子 .py のファイルの関連付けが見つかりません
aws-cli/1.16.200 Python/3.7.4 Windows/10 botocore/1.12.190

□手順 11: aws configureコマンドを実行して認証情報などを記録させます

PS C:\> & aws configure
拡張子 .py のファイルの関連付けが見つかりません
AWS Access Key ID [None]: <My AWS Access Key>
AWS Secret Access Key [None]: <AWS Secret Access Key>
Default region name [None]: ap-northeast-1
Default output format [None]: json

--profileオプションを付与することでプロファイルの作成も可能です

デフォルトのプロファイルには読み取り権限のみをもったアカウントを登録しておき変更可能な権限はDevOpsDevelopersなどのプロファイルに紐付けておけば誤った変更などを避けられるので安全です

PS C:\> & aws configure --profile DevOps
拡張子 .py のファイルの関連付けが見つかりません
AWS Access Key ID [None]: <My AWS Access Key>
AWS Secret Access Key [None]: <AWS Secret Access Key>
Default region name [None]: ap-northeast-1
Default output format [None]: json

手順 12: aws s3 lsコマンドなどを実行して正常にAWS環境に接続できることを確認します

PS C:\> & aws s3 ls --no-verify
拡張子 .py のファイルの関連付けが見つかりません
%USERPROFILE%\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3-1.25.3-py3.7.egg\urllib3\connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
2019-MM-DD hh:mm:ss xxxx
:

私の環境では--no-verifyオプションを付与せずに実行すると次のエラーメッセージが出力されてしまいました

PS C:\> & aws s3 ls
拡張子 .py のファイルの関連付けが見つかりません
SSL validation failed for https://s3.ap-northeast-1.amazonaws.com/ [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)

おまけ:拡張子 .py のファイルの関連付けが見つかりませんという警告メッセージへの対応

管理者権限を有しているアカウントで下記コマンドを実行してもらうことができれば解決できるはずです。。。

PS C:\> & assoc .py=Python.File
PS C:\> & ftype Python.File="%USERPROFILE%\AppData\Local\Programs\Python\Python37\python.exe" "%1" %*

以上、管理者権限を持たないWindows端末に「AWSコマンドラインインターフェイス(awscli)」をインストールする手順でした。

4
5
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
4
5