This gem provides a simple way to retrieve upfront and hourly costs for Amazon EC2 On Demand and Reserved Instances.
Add this line to your application's Gemfile:
gem 'ec2_pricing'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ec2_pricing
For either type of instance, simply specify the region, instance type, and price type you'd like to see.
instances = Ec2Pricing::Instances.on_demand
instances['us-east']['m3.medium']['hourly'] # hourly cost for an m3.medium On Demand Instance in US-East
instances = Ec2Pricing::Instances.reserved
instances['us-east']['m3.medium']['1yr']['upfront'] # upfront cost with a 1-year commitment
instances['us-east']['m3.medium']['1yr']['hourly'] # hourly cost with a 1-year commitment
- Fork it ( https://github.com/NotDaveLane/ec2_pricing/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request