简体   繁体   中英

How to display particular EC2 instance cost (price details) through java programmatically

I am creating AWS instances programmatically using AWS Java API. This entire process is developed as an web application.

Now the question is, after successfully purchasing an EC2 instance, how can I display the price details of that particular customer's instance cost?

This is not a capability exposed by the AWS EC2 API.

The pricing of instances is a back-office billing function, not a function of the real-time EC2 operational infrastructure, since -- among other reasons -- there are tiered volume discounts for large customers ... and the rating of reserved instances is not related to particular instances but is actually determined by how many instances you are running, correlated with the number of matching instances purchased. (Whether a particular instance is billed as reserved or not can vary throughout the lifetime of the instance, if others are also running)... and spot instances are billed based on historical prices as they stood at the beginning of the spot instance's operational hour, each hour, not in fractional hours, even though the spot market price can fluctuate several times per hour.

The only known mechanism is the unofficial, unsupported, undocumented hack mentioned in the other question you referenced . If you go that route, implementing it should be a pretty trivial exercise in Java or any other language... but the pricing you would be able to display would be an approximation.

Believe this has changed. For anyone who lands here on a first search like I did.

https://aws.amazon.com/blogs/aws/new-aws-price-list-api/

AWS Blog

New – AWS Price List API by Jeff Barr | on 09 DEC 2015 | Permalink | Comments Many AWS customers and partners have been asking for a programmatic way to access prices for AWS services. This information can be used in several ways. Some potential customers are evaluating the feasibility and cost-effectiveness of moving their on-premises workloads to the cloud and want to “do the math.” Current customers and partners would like to make sure that their budgeting, forecasting, and analytics tools are able to analyze AWS prices without having to resort to scraping our web site. Our Managed Services Partners create and supervise tens or thousands of linked AWS accounts (grouped together via Consolidated Billing) and need to make sure the bills presented to their customers reflect the cost of each resource.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM