AWSCosts allows programmatic access to AWS pricing.
Useful for calculating the running costs of your fleet of EC2 instances and associated services such as ELBs, RDS, CloudWatch, etc.
Add this line to your application's Gemfile:
Or install it yourself as:
$ gem install awscosts
Pricing is usually defined by region
region = AWSCosts.region 'us-east-1'
To find the price of all on-demand EC2 instances running linux
You can pass an argument to price to filter by the instance type.
To find the upfront price of reserving Windows instance for a one year term and light utilization
region.ec2.reserved(:windows, :light).upfront(:one_year, :light)
To find the hourly price of a
m1.large reserved Windows with SQL instance for
a three year and medium utilization
region.ec2.reserved(:windows_with_sql, :medium).hourly(:three_year, 'm1.large')
To find the hourly price of an ELB in the Sydney region.
To find the price per GB processed of an ELB in the Sydney region.
To find the on demand EC2 price and Elastic MapReduce price for the Oregon region.
To find the First 1 TB / month price in the Singapore region which includes the Standard Storage, Reduced Redundancy Storage, and the Glacier Storage
Pricing is also available for data transfer
And request pricing
To find the price of Amazon EBS standard volumes in the Ireland region.
.price also supports
To find the price of an non-attached Elastic IP address (EIP) per hour:
Other pricing available for EIPs includes:
The following AWS services are currently support (more to come):
- On-demand instances
- Reserved light utilisation
- Reserved medium utilisation
- Reserved heavy utilisation
- Elastic Load Balancer (ELB)
- Elastic Block Storage (EBS)
- Elastic MapReduce (EMR)
- Elastic IP Address (EIP)
- Linux (:linux)
- RHEL (:rhel)
- SLES (:sles)
- Windows (:windows)
- Windows with SQL (:windows_with_sql)
- Windows with SQL Web (:windows_with_sql_web)
Possible items on the roadmap are:
- Cost calculation using a DSL to describe your AWS environment.
- Cost calculation from a Cloudformation template.
- Fork it
- 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