Skip to content

Instantly share code, notes, and snippets.

@morkot
Last active May 1, 2018 13:37
Show Gist options
  • Save morkot/4206e5accddcb0a2dd0ed89c7b380538 to your computer and use it in GitHub Desktop.
Save morkot/4206e5accddcb0a2dd0ed89c7b380538 to your computer and use it in GitHub Desktop.

AWS CLI Examples with filters and queryies

Get latest Amazon Linux AMI

aws ec2 describe-images \
  --owners amazon \
  --filters 'Name=name,Values=amzn-ami-hvm-2018.??.?.*-x86_64-gp2' 'Name=state,Values=available' \
  | jq -r '.Images
      | sort_by(.CreationDate)
      | last(.[]).ImageId'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment