Skip to content

Instantly share code, notes, and snippets.

@mausch
Created January 10, 2020 17:53
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 mausch/7834888398af8bac39277fcecb394389 to your computer and use it in GitHub Desktop.
Save mausch/7834888398af8bac39277fcecb394389 to your computer and use it in GitHub Desktop.
Get current EC2 spot prices in your region
# thanks to https://stackoverflow.com/a/32967407 for the CSV output
aws ec2 describe-spot-price-history --product-description "Linux/UNIX (Amazon VPC)" --start-time "$(date +%s)" | jq '.SpotPriceHistory | group_by(.InstanceType) | [.[] | min | {InstanceType, SpotPrice}]' | jq -r '(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ]])[] | @csv' | less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment