3
1

More than 1 year has passed since last update.

【2021年12月版】RaspbianでAWS CLI v2を動かす

Last updated at Posted at 2021-12-31

ラズパイでAWS CLI使いたくても公式サイトではダウンロードできない

AWS CLI、ARM対応してくれてますが、公式サイトで手順が紹介されているのはx86_64かaarm64のアーキテクチャのみ。ラズパイ用のバイナリはダウンロードできません。。。
そこで以下の記事にある手順に従って、pip経由でソースからインストールを行ってみます。

インストールしてみる

AWS CLI の実態である botocore(低レベルAPI) と aws-cli(CLI向け高レベルAPI) の v2 ブランチを pip 経由で GitHub からインストールします、とのこと。

$ python3 -mpip install https://github.com/boto/botocore/archive/v2.tar.gz
....
Installing collected packages: awscrt, botocore
  Attempting uninstall: botocore
    Found existing installation: botocore 1.23.26
    Uninstalling botocore-1.23.26:
      Successfully uninstalled botocore-1.23.26
Successfully installed awscrt-0.12.4 botocore-2.0.0.dev155

$ python3 -mpip install https://github.com/aws/aws-cli/archive/v2.tar.gz
...
Installing collected packages: pycparser, wcwidth, cffi, ruamel.yaml, prompt-toolkit, distro, cryptography, awscli
Successfully installed awscli-2.4.7 cffi-1.15.0 cryptography-3.3.2 distro-1.5.0 prompt-toolkit-2.0.10 pycparser-2.21 ruamel.yaml-0.15.100 wcwidth-0.1.9

aws-cliのビルドには大層時間がかかります。めっっっちゃ時間かかります。不安なのでtopコマンドで見守りつつ、待っていたらインストールが完了いたしました。
そしてバージョンのチェック!

$ aws --version
aws-cli/2.4.7 Python/3.7.3 Linux/5.10.17-v7l+ source/armv7l.raspbian.10 prompt/off

はい、無事にビルドしてRaspbianで動くようになりました。

ユーザーの設定

あとはいつも通り、awsのユーザーを設定します。

$ aws configure
AWS Access Key ID [None]: xxxxxxxxx
AWS Secret Access Key [None]: xxxxxxx
Default region name [None]: ap-northeast-1
Default output format [None]: json

はい、設定完了です。
登録情報を確認してみましょう。

$ aws configure list
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key     ******************** shared-credentials-file    
secret_key     ******************** shared-credentials-file    
    region           ap-northeast-1      config-file    ~/.aws/config

以上でAWSのコマンドがラズパイ上で使えるようになりました。

さて、やっとスタートラインです。。。

3
1
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
3
1