cluster deboistech.in Get started
Cheatsheet

AWS

The AWS CLI commands for identity, storage, servers, networks, databases and clean-up, with the options you forget.

Practice this path

Set up and identity

  • aws configure

    Save an access key, secret, default Region and output format

  • aws configure --profile dev

    Keep a second set of credentials under a name

  • aws sts get-caller-identity

    Show the account and identity behind the credentials

  • aws <service> <command> --profile dev --region eu-west-1

    Choose a profile and Region for one command

  • aws ec2 describe-instances --query "Reservations[].Instances[].InstanceId" --output text

    Use --query (JMESPath) and --output to shape the answer

IAM

  • aws iam create-user --user-name alice

    Create a user

  • aws iam attach-user-policy --user-name alice --policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess

    Attach a managed policy

  • aws iam create-access-key --user-name alice

    Make a key pair (shown once: store it safely)

  • aws iam list-attached-user-policies --user-name alice

    See what a user is allowed

  • aws iam simulate-principal-policy --policy-source-arn ARN --action-names s3:GetObject

    Test whether a policy allows an action

S3

  • aws s3 mb s3://my-unique-bucket-123

    Make a bucket (names are global)

  • aws s3 cp file.txt s3://my-unique-bucket-123/

    Upload a file

  • aws s3 sync ./site s3://my-unique-bucket-123 --delete

    Make the bucket match a folder

  • aws s3 ls s3://my-unique-bucket-123 --recursive --human-readable

    List objects with sizes

  • aws s3api put-bucket-versioning --bucket B --versioning-configuration Status=Enabled

    Keep old versions of objects

  • aws s3 rb s3://my-unique-bucket-123 --force

    Delete a bucket and everything in it

EC2

  • aws ec2 run-instances --image-id ami-0abc --instance-type t3.micro --key-name mykey

    Launch an instance

  • aws ec2 describe-instances --filters Name=instance-state-name,Values=running

    List running instances

  • aws ec2 stop-instances --instance-ids i-0123

    Stop (start-instances starts it again)

  • aws ec2 terminate-instances --instance-ids i-0123

    Delete an instance for good

  • aws ec2 create-tags --resources i-0123 --tags Key=Env,Value=dev

    Tag a resource (tags drive cost reports)

  • aws ec2 create-security-group --group-name web --description "web" --vpc-id vpc-0abc

    Create a firewall group

  • aws ec2 authorize-security-group-ingress --group-id sg-0abc --protocol tcp --port 443 --cidr 0.0.0.0/0

    Open a port

VPC and networking

  • aws ec2 create-vpc --cidr-block 10.0.0.0/16

    Create a private network

  • aws ec2 create-subnet --vpc-id vpc-0abc --cidr-block 10.0.1.0/24 --availability-zone eu-west-1a

    Add a subnet in one zone

  • aws ec2 create-internet-gateway

    A door to the internet (then attach it to the VPC)

  • aws ec2 create-route --route-table-id rtb-0abc --destination-cidr-block 0.0.0.0/0 --gateway-id igw-0abc

    Send internet traffic through the gateway

Databases, volumes and monitoring

  • aws ec2 create-volume --size 10 --availability-zone eu-west-1a

    Create an EBS volume (attach it in the same zone)

  • aws rds describe-db-instances --query "DBInstances[].DBInstanceIdentifier"

    List databases

  • aws rds delete-db-instance --db-instance-identifier db1 --skip-final-snapshot

    Delete a database without a last snapshot

  • aws cloudwatch put-metric-alarm --alarm-name cpu-high --metric-name CPUUtilization --namespace AWS/EC2 --statistic Average --period 300 --threshold 80 --comparison-operator GreaterThanThreshold --evaluation-periods 2

    Alarm on high CPU

  • aws sns create-topic --name alerts

    A topic that alarms can notify

Cost and clean-up

Everything you create can cost money. Delete it when you are done.

  • aws budgets describe-budgets --account-id 123456789012

    List your budgets

  • aws ce get-cost-and-usage --time-period Start=2026-10-01,End=2026-10-20 --granularity DAILY --metrics UnblendedCost

    Cost per day (each call is billed)

  • aws resourcegroupstaggingapi get-resources --tag-filters Key=Env,Values=dev

    Find everything with a tag

  • aws cloudformation delete-stack --stack-name demo

    Delete a stack and all it created

Cheatsheet for the AWS path · Deboistech · All cheatsheets