Skip to content

Instantly share code, notes, and snippets.

@lmayorga1980
Last active January 15, 2019 14:34
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 lmayorga1980/d1027e130de98b4faa32df0cfde8653b to your computer and use it in GitHub Desktop.
Save lmayorga1980/d1027e130de98b4faa32df0cfde8653b to your computer and use it in GitHub Desktop.
Queries to find specific AMIS based on the name
aws ec2 describe-images --owners amazon --filters 'Name=name,Values=Windows_Server-2016-English-Full-Base-????.??.??' 'Name=state,Values=available' | jq -r '.Images | sort_by(.CreationDate) | last(.[]).ImageId '
aws ec2 describe-images --owners amazon --filters 'Name=name,Values=Windows_Server-2012-R2_RTM-English-P3-????.??.??' 'Name=state,Values=available' | jq -r '.Images | sort_by(.CreationDate) | last(.[]).ImageId '
aws ec2 describe-images --owners amazon --filters 'Name=name,Values=Windows_Server-2016-English-Core-Base-????.??.??' 'Name=state,Values=available' | jq -r '.Images | sort_by(.CreationDate) | last(.[]).ImageId '
aws ec2 describe-images --owners amazon --filters 'Name=name,Values=Windows_Server-2019-English-Core-Base-????.??.??' 'Name=state,Values=available' | jq -r '.Images | sort_by(.CreationDate) | last(.[]).ImageId '
aws ec2 describe-images --owners amazon --filters 'Name=name,Values=Windows_Server-2019-English-Full-Base-????.??.??' '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