-
-
Save deinspanjer/b9dfb36a470dc82582372eb4a1bd9702 to your computer and use it in GitHub Desktop.
check current spot price with aws-cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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