Created
March 19, 2012 02:22
-
-
Save robbyt/2090963 to your computer and use it in GitHub Desktop.
find standard average (mean) ec2 spot instance price
This file contains hidden or 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
import boto | |
#type that you want to get pricing on | |
MY_TYPE = u'm1.small' | |
ec2 = boto.connect_ec2() | |
spots = ec2.get_spot_price_history(instance_type= MY_TYPE) | |
spot_prices = [i.price for i in spots] | |
price = sum(spot_prices)/len(spot_prices) | |
print "The average price of a {0} instance is: {1}".format(MY_TYPE, price) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment