A memo note of the steps to deploy the AWS CLI on Ubuntu 20.04.
Create Ubuntu 20.04 and connect with SSH
Create working directory
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
Generate an Access Key ID and Secret Access Key in AWS IAM and configure them with the aws configure command
region : ap-northeast-1
aws configure
In my environment, I use fish instead of bash. Complete the fish CLI for AWS CLI
vim ~/.config/fish/completions/aws.fish
The contents of the file
complete -c aws -f -a '(
begin
set -lx COMP_SHELL fish
set -lx COMP_LINE (commandline)
aws_completer
end
)'
List of EC2
aws ec2 describe-instances --query "Reservations[].Instances[].Tags[?Key==`Name`].Value[]"
Execution example
> aws ec2 describe-instances --query "Reservations[].Instances[].Tags[?Key==`Name`].Value[]"
[
"StepBox"
]
Document https://docs.aws.amazon.com/ja_jp/cli/latest/userguide/install-cliv2-linux.html
Recommended Posts