使用批量价目表 API 获取 Amazon 价目表文件 - Amazon 账单
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用批量价目表 API 获取 Amazon 价目表文件

要提供相关的反馈 Amazon 价目表,请完成这份简短的调查。您的回复将是匿名的。注意:本调查仅提供英文版。

我们建议您在要执行以下任务时使用价目表批量处理 API:

  • 消耗大量的 Amazon Web Services产品和定价信息。

  • 以高吞吐量消耗大量的 Amazon Web Service产品和定价信息,例如批量处理。

此外,当价目表查询 API 无法为您的用例提供足够的吞吐量和限额时,请使用价目表批量处理 API。

我们建议您使用批量 Amazon 价目表 API 以编程方式查找和下载价目表文件。要获取价目表文件的 URL,请参阅以下步骤。

如果您不想使用批量 Amazon 价目表 API,可以手动下载价目表文件。有关更多信息,请参阅 手动获取价目表文件

使用 DescribeServices API 操作查找价目表批量处理 API 支持的所有可用 Amazon Web Services 。此 API 操作返回服务列表中的 ServiceCode 值。您稍后使用此值来查找相关的价目表文件。

例 示例:查找可用服务

以下命令说明如何查找可用的 Amazon Web Services。

aws pricing describe-services --region cn-northwest-1

Amazon Web Services 区域 是价目表批量 API 的 API 端点。端点与产品或服务属性无关。

响应

{ "FormatVersion": "aws_v1", "NextToken": "abcdefg123", "Services": [ { "AttributeNames": [ "volumeType", "maxIopsvolume", "instanceCapacity10xlarge", "locationType", "operation" ], "ServiceCode": "AmazonEC2" }, { "AttributeNames": [ "productFamily", "volumeType", "engineCode", "memory" ], "ServiceCode": "AmazonRDS" }, {...} ] }

有关此 API 操作的更多信息,请参阅《API 参考》中的DescribeServices特定语言的 Amazon SDKAmazon Billing and Cost Management

使用 ListPriceLists API 操作获取您有权查看的价目表参考清单。要筛选结果,您可以指定 ServiceCodeCurrencyCode、和 EffectiveDate 参数。

Amazon Web Services 区域 是价目表批量 API 的 API 端点。端点与产品或服务属性无关。

查找价目表文件的示例

例 示例:查找所有人的价目表文件 Amazon Web Services 区域

如果您未指定 --region-code 参数,则 API 操作会返回所有可用 Amazon Web Services 区域的价目表文件参考。

aws pricing list-price-lists --service-code AmazonRDS --currency-code USD --effective-date "2023-04-03 00:00"

响应

{ "NextToken": "abcd1234", "PriceLists": [ { "CurrencyCode": "USD", "FileFormats": [ "json", "csv" ], "PriceListArn": "arn:cn:pricing:::price-list/cn/AmazonRDS/USD/20230328234721/cn-northwest-1", "RegionCode": "cn-northwest-1" }, { "CurrencyCode": "USD", "FileFormats": [ "json", "csv" ], "PriceListArn": "arn:cn:pricing:::price-list/cn/AmazonRDS/USD/20230328234721/cn-northwest-1", "RegionCode": "cn-northwest-1" }, ... ] }
例 示例:查找特定区域的价目表文件

如果您指定 RegionCode 参数,API 操作将返回该区域特定的价目表文件参考。要查找历史价目表文件,请使用 EffectiveDate 参数。例如,您可以指定过去的日期来查找特定的价目表文件。

然后,您可以从响应中将 PriceListArn 值与 GetPriceListFileUrl API 操作配合使用,以获取您的首选价目表文件。

aws pricing list-price-lists --service-code AmazonRDS --currency-code USD --region-code cn-northwest-1 --effective-date "2023-04-03 00:00"

响应

{ "PriceLists": [ { "CurrencyCode": "USD", "FileFormats": [ "json", "csv" ], "PriceListArn": "arn:cn:pricing:::price-list/cn/AmazonRDS/USD/20230328234721/cn-northwest-1", "RegionCode": "cn-northwest-1" } ] }

有关此 API 操作的更多信息,请参阅《API 参考》Amazon Billing and Cost Management 中的ListPriceLists特定语言的 Amazon SDK

使用 GetPriceListFileUrl API 操作获取价目表文件的 URL。此 URL 基于您在第 1 步第 2 步中从 ListPriceLists 响应中检索到的 PriceListArnFileFormats 值。

例 示例:获取特定的价目表文件

以下命令获取 Amazon RDS 特定价目表文件的 URL。

aws pricing get-price-list-file-url --price-list-arn arn:cn:pricing:::price-list/cn/AmazonRDS/USD/20230328234721/cn-northwest-1 --file-format json --region cn-northwest-1

响应

{ "Url": "https://pricing.cn-northwest-1.amazonaws.com/offers/v1.0/aws/AmazonRDS/20230328234721/cn-northwest-1/index.json" }

从响应中,您可以使用 URL 下载价目表文件。

有关此 API 操作的更多信息,请参阅以下主题: