Notes to Self

Alex Sokolsky's Notes on Computers and Programming

AWS CLI Client

User Guide

Install

Instructions:

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

Use

Verify the version:

$ aws --version
aws-cli/2.4.29 Python/3.8.8 Linux/5.13.0-37-generic exe/x86_64.linuxmint.20 prompt/off

or on Windows:

PS C:\Users\asoko> aws --version
aws-cli/2.5.2 Python/3.9.11 Windows/10 exe/AMD64 prompt/off

Configure, e.g. for local use:

PS C:\Users\asoko> aws configure
AWS Access Key ID [None]: keyid
AWS Secret Access Key [None]: accesskey
Default region name [None]: us-west-1
Default output format [None]:

Key-pair Create/Delete

Before anything:

export AWS_PROFILE=default

Create the key-pair:

aws ec2 create-key-pair --key-name _name_ --key-type ed25519 \
    --query "KeyMaterial" --output text > _name_.pem

then:

chmod 400 _name_.pem

To create a .pub public key from .pem:

ssh-keygen -y -f _name_.pem > _name_.pub

Delete the key-pair:

aws ec2 delete-key-pair --key-name _name_