LoginSignup
3
5

More than 3 years have passed since last update.

AWS CLI install in Ubuntu 20.04

Posted at

はじめに

Ubuntu 20.04 に AWS CLI を導入する手順を備忘録としてメモです。

EC2の準備

適当に Ubuntu 20.04 を作成して、SSH 接続します

AWS CLI の Install

作業用ディレクトリ作成

mkdir ~/temp
cd ~/temp

AWS CLI Install

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

AWS CLI の 設定

AWS IAM で Access Key ID と Secret Access Key を生成して、aws configure コマンドで設定します

region : ap-northeast-1

aws configure

Fish 補完の設定

自分の環境では、bash ではなく fish を使っています。fish の AWS CLI 用補完設定をします

vim ~/.config/fish/completions/aws.fish

ファイルの中身

complete -c aws -f -a '(
    begin
        set -lx COMP_SHELL fish
        set -lx COMP_LINE (commandline)
        aws_completer
    end
)'

動作確認

EC2 の一覧

aws ec2 describe-instances --query "Reservations[].Instances[].Tags[?Key==`Name`].Value[]"

実行例

> aws ec2 describe-instances --query "Reservations[].Instances[].Tags[?Key==`Name`].Value[]"
[
    "StepBox"
]

参考URL

Document
https://docs.aws.amazon.com/ja_jp/cli/latest/userguide/install-cliv2-linux.html

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