Skip to content

Instantly share code, notes, and snippets.

@deinspanjer
Forked from pahud/check_spot_price_now.md
Created January 4, 2018 17:57
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 deinspanjer/b9dfb36a470dc82582372eb4a1bd9702 to your computer and use it in GitHub Desktop.
Save deinspanjer/b9dfb36a470dc82582372eb4a1bd9702 to your computer and use it in GitHub Desktop.
check current spot price with aws-cli
aws ec2 describe-spot-price-history --instance-types $(aws ec2 describe-spot-price-history help | sed -En '/Where valid values are:/,/^$/s/^ +([^.]+[.])/\1/p') --start-time=$(echo "$(date +%s) - (4 * 7 * 24 * 60 * 60)" | bc) --product-descriptions="Linux/UNIX (Amazon VPC)" --query 'SpotPriceHistory[*].{ts:Timestamp, az:AvailabilityZone, price:SpotPrice, it:InstanceType}' --filters Name=spot-price,Values="0.0*" > /tmp/ec2-spot-prices.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment