如何以编程方式通过 java 显示特定的 EC2 实例成本(价格详细信息)

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

我正在使用 AWS Java API 以编程方式创建 AWS 实例。这整个过程是作为一个网络应用程序开发的。

现在的问题是,在成功购买EC2实例后,如何显示该特定客户实例成本的价格明细?

这不是 AWS EC2 公开的功能API。

实例的定价是后台计费功能,而不是实时 EC2 运营基础设施的功能,因为 - 除了其他原因 - 大客户有分层的批量折扣......预留实例的评级与特定实例无关,但实际上取决于您 运行 的实例数量,与购买的匹配实例数量相关。 (如果其他实例也是 运行),那么在实例的整个生命周期中,特定实例是否被计费可能会有所不同 运行)...并且 spot 实例是根据它们在开始时的历史价格计费的spot 实例的运行时间,每小时,而不是小数小时,即使 spot 市场价格每小时可能波动几次。

唯一已知的机制是 other question you referenced 中提到的非官方、不受支持、未记录的黑客攻击。如果你走那条路,用 Java 或任何其他语言实现它应该是一个非常简单的练习......但你能够显示的价格将是一个近似值。

相信这已经改变了。对于像我一样第一次搜索就来到这里的人。

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.