iocalhost.nl // no place like ::1
references Network & Web AWS CLI

AWS CLI

Veelgebruikte commando's voor S3, EC2, IAM en configuratie.

Configuratie

aws configure                       sleutels + region instellen
aws configure --profile prod
aws sts get-caller-identity         wie ben ik?
export AWS_PROFILE=prod
aws --region eu-west-1 ...

S3

aws s3 ls                           buckets
aws s3 ls s3://bucket/pad/
aws s3 cp bestand s3://bucket/pad/
aws s3 cp s3://bucket/key ./        downloaden
aws s3 sync ./map s3://bucket/pad/  synchroniseren
aws s3 sync s3://bucket/ ./back-up --delete
aws s3 rm s3://bucket/key
aws s3 mb s3://nieuwe-bucket        bucket maken

EC2

aws ec2 describe-instances \
  --query 'Reservations[].Instances[].{id:InstanceId,state:State.Name,ip:PublicIpAddress}' \
  --output table
aws ec2 start-instances --instance-ids i-123
aws ec2 stop-instances  --instance-ids i-123
aws ec2 describe-security-groups

IAM & overig

aws iam list-users
aws iam list-roles
aws logs tail /aws/lambda/fn --follow
aws ssm start-session --target i-123        shell zonder ssh

Output & queries

aws ... --output json|table|text
aws ... --query 'Items[?status==`active`].name'    JMESPath-filter