Reserved Instance discount calcurator
Ruby Makefile
Latest commit 3db58a2 Oct 30, 2016 @s-tajima fix
Permalink
Failed to load latest commit information.
bin
lib
spec
.gitignore
.travis.yml
Gemfile
LICENSE
Makefile
README.md
Rakefile

README.md

AWS Reserved Instance discount calculator

aws-ri-discount-calculator calcurates Reserved Instance discount by monthly report csv.

Build Status

$ bundle exec bin/calc ./PATH_TO_REPORT/AAA775901AAA-aws-billing-csv-YYYY-MM.csv
+--------------+----------------+--------------+--------------+
| account_id   | csv_total_cost | ec2_discount | rds_discount |
+--------------+----------------+--------------+--------------+
| AAA775901AAA | $100.123       | $20.111      | $10.987      |
| BBB748336BBB | $500.03        | $100.456     | $0.0         |
| CCC061764CCC | $10.149        | $0.0         | $0.0         |
| ...          | ...            | ...          | ...          |
| ZZZ654481ZZZ | $1358.917      | $479.434     | $240.934     |
| ------------ | -------------- | ------------ | ------------ |
| total        | $3470.013      | $850.62      | $450.0       |
+--------------+----------------+--------------+--------------+

Index

Requirements

aws-ri-discount-calculator requires the following to run:

※ No IAM credential required.

Installation

$ git clone <this repository url>
$ cd aws-ri-discount-calculator
$ bundle install

Usage

  • table output
$ bundle exec bin/calc ./PATH_TO_REPORT/AAA775901AAA-aws-billing-csv-YYYY-MM.csv
+--------------+----------------+--------------+--------------+
| account_id   | csv_total_cost | ec2_discount | rds_discount |
+--------------+----------------+--------------+--------------+
| AAA775901AAA | $100.123       | $20.111      | $10.987      |
| BBB748336BBB | $500.03        | $100.456     | $0.0         |
| CCC061764CCC | $10.149        | $0.0         | $0.0         |
| ...          | ...            | ...          | ...          |
| ZZZ654481ZZZ | $1358.917      | $479.434     | $240.934     |
| ------------ | -------------- | ------------ | ------------ |
| total        | $3470.013      | $850.62      | $450.0       |
+--------------+----------------+--------------+--------------+
  • tsv output (for paste Excel etc...)
$ bundle exec bin/calc ./PATH_TO_REPORT/AAA775901AAA-aws-billing-csv-YYYY-MM.csv tsv
account_id  csv_total_cost  ec2_discount    rds_discount
AAA775901AAA    $100.123    $20.111 $10.987
BBB748336BBB    $500.03 $100.456    $0.0
CCC061764CCC    $10.149 $0.0    $0.0
... ... ... ...
ZZZ654481ZZZ    $1358.917   $479.434    $240.934

How does it work

  1. Parse monthly report csv.
  2. Find line for reserved instance usage. Retrieve BlendedRate, UsageQuantity.
  3. Retrieve Ondemand Price by AWS Price List API
  4. Calculate (Ondemand Price - BlendedRate) * UsageQuantity.

Notes

  • Implemented services are EC2 RDS only.
  • XXX_discount columns DON'T include(subtract) purchase costs of RI.

License

MIT

Author

Satoshi Tajima