Skip to content

Instantly share code, notes, and snippets.

@3m3x
Last active September 12, 2019 08:01
Show Gist options
  • Save 3m3x/73e664618751e8c47920ae58dcd365f6 to your computer and use it in GitHub Desktop.
Save 3m3x/73e664618751e8c47920ae58dcd365f6 to your computer and use it in GitHub Desktop.
AWS CLI cheat sheet
# Anonymously read and write to S3 bucket
aws s3 ls s3://$RANDOM_BUCKET/ --region us-east-1 --no-sign-request
aws s3 cp $HOME/my_file.js s3://$RANDOM_BUCKET/js/ --region us-east-1 --no-sign-request
# Show all hosted zones
aws route53 list-hosted-zones | jq '.HostedZones [] .Name'
# Show route tables
aws ec2 describe-route-tables | \jq '.RouteTables | .[] | .Routes [] | .GatewayId + " " + .DestinationCidrBlock' | sort | uniq
# Show Network ACLs
aws ec2 describe-network-acls | jq '.NetworkAcls [] .Entries [] | .Protocol + " " + .RuleAction + " " + .CidrBlock' | sort | uniq
# Show all users
aws iam list-users | jq '.Users [] .Arn'
# Show all IAM roles
aws iam list-roles | jq '.Roles [] .Arn'
# Show all encryption key names
aws ec2 describe-key-pairs | jq '.[][] .KeyName'
# Show customer support cases
aws support describe-cases --include-resolved-cases | jq '.cases [] | .subject'
# Show email addresses in customer support cases
aws support describe-cases --include-resolved-cases | jq '.cases [] | .submittedBy, .ccEmailAddresses []' | sort | uniq
# Show encryption status of all EBS volumes
aws --region us-east-1 ec2 describe-volumes | jq '.Volumes [] | .VolumeId + " encrypted: " + (.Encrypted|tostring)'
# Show Application Load Balancer ARNs
aws --region us-east-1 elbv2 describe-load-balancers|jq '.LoadBalancers [] | .LoadBalancerArn'
# Get usernames and their ARNs
aws iam list-users|jq '.Users [] | .UserName + " " + .Arn'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment