We are using Amazon's EC2 We would like to be able to write a program that calculates how much we spent between time to time?
We figured that it's possible to download the usage report and apply the pricing rules.. Is there any better way? Direct API? Is it possible to do it in real-time(the reports are somewhat delayed)
Usage-report: https://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=usage-report
You can view the reports using spreadsheet software such as Microsoft Excel or Apache OpenOffice Calc, or access them from an application using the Amazon S3 API. AWS Cost and Usage Reports tracks your AWS usage and provides estimated charges associated with your account.
AWS Pricing Calculator is useful both for people who have never used AWS and for those who want to reorganize or expand their usage. AWS Pricing Calculator allows you to explore AWS services based on your use cases and create a cost estimate.
Your Amazon EC2 usage is calculated by either the hour or the second based on the size of the instance, operating system, and the AWS Region where the instances are launched. Pricing is per instance-hour consumed for each instance, from the time an instance is launched until it's terminated or stopped.
To estimate a bill, use the AWS Pricing Calculator. Choose Create estimate, and then choose your planned resources by service. The AWS Pricing Calculator provides an estimated cost per month.
Unfortunately Amazon don't provide real-time data (and, in fact, you'll probably notice that the accuracy of Amazon's usage reports will vary within the current billing period), nor do they provide an API to query their current prices.
We currently do this for our systems and have found a combination of the following works well:
At each estimation stage we do a very primitive adjustment so the totals work out: we apply a credit/charge to bring the figure in line with the next level of estimate.
You can spend a LOT of effort trying to get these estimates as accurate as possible - it largely depends on how much data collection and maintenance overhead you're willing to bear.
We account for usage on a per-application basis (where each Instance may be reused within an instance-hour for multiple applications) so the collection overhead and maintenance of this code is worth it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With