aws-ri-discount-calculator calcurates Reserved Instance discount by monthly report csv.
$ 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 |
+--------------+----------------+--------------+--------------+
aws-ri-discount-calculator requires the following to run:
- Ruby
- Monthly report csv.
※ No IAM credential required.
$ git clone <this repository url>
$ cd aws-ri-discount-calculator
$ bundle install
- 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
- Parse monthly report csv.
- Find line for reserved instance usage. Retrieve BlendedRate, UsageQuantity.
- Retrieve Ondemand Price by AWS Price List API
- Calculate
(Ondemand Price - BlendedRate) * UsageQuantity
.
- Implemented services are EC2 RDS only.
- XXX_discount columns DON'T include(subtract) purchase costs of RI.