Skip to content

Instantly share code, notes, and snippets.

@jpotts18
Last active June 20, 2018 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpotts18/1111cd8c32485ed49449fb2e4d3bb644 to your computer and use it in GitHub Desktop.
Save jpotts18/1111cd8c32485ed49449fb2e4d3bb644 to your computer and use it in GitHub Desktop.
AWS CLI JMESPath Cheatsheet

List all SNS topics

aws sns list-topics --query 'Topics[*]' --output text | cut -d ':' -f 6

List all buckets

aws s3 ls | cut -d ' ' -f 3

List all Cloudwatch Alarms

aws cloudwatch describe-alarms \ 
   --query 'MetricAlarms[*].{arn:AlarmArn, name:AlarmName,threshold:Threshold, statistic:Statistic, state:StateValue}'

List EC2 networking configuration

aws ec2 describe-instances \
   --filters "Name=instance-state-name,Values=running" \
   --query="Reservations[*].Instances[*].{instance_id: InstanceId, vpc_id: VpcId, availaiblity_zone: Placement.AvailabilityZone, instance_type: InstanceType, subnet_id: SubnetId}" \
   --output=text

List DNS Records sets in hosted zone

aws route53 list-resource-record-sets --hosted-zone-id={ZoneID}

List SQS

aws sqs list-queues --query 'QueueUrls[*]' --output text | tr '\t' '\n' | cut -d '/' -f 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment