Skip to content

Instantly share code, notes, and snippets.

@robbyt
Created March 19, 2012 02:22
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robbyt/2090963 to your computer and use it in GitHub Desktop.
Save robbyt/2090963 to your computer and use it in GitHub Desktop.
find standard average (mean) ec2 spot instance price
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