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

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

使用 Free Tier API

Amazon Web Services 中国区免费套餐 提供了每月可免费使用 Amazon Web Services 和产品的机会。借助 Free Tier API,您将能够以编程方式根据月度使用量限额跟踪免费套餐的使用情况。

使用该 API 了解您每月的免费使用量何时会变为即用即付定价模式。通过将整月的预测使用量与每项服务的免费套餐限额进行比较,有助于您避免产生意外的费用。例如,要了解您的使用量何时可能超过 Amazon Glue 的免费优惠限额,您可以使用该 API 来跟踪您的 Amazon Web Services 账户使用情况。然后,您可以在免费套餐限额到期之前决定是继续使用该服务,还是进行任何调整。

您还可以使用该 API 创建可视化效果或编写脚本,以根据您的 API 响应自动调整 Amazon 资源。

例 示例:查找您的 Amazon Glue 免费套餐优惠

以下 Amazon Command Line Interface(Amazon CLI)命令使用 GetFreeTierUsage API 操作,来按 Amazon Glue 免费套餐使用情况进行筛选。

请求

aws freetier get-free-tier-usage --filter '{"Dimensions": {"Key": "SERVICE", "Values": ["Glue"], "MatchOptions": ["CONTAINS"]}}'

响应

以下响应返回了来自 Amazon Glue 的两个 Always Free 优惠。

{ "freeTierUsages": [ { "actualUsageAmount": 287.0, "description": "1000000.0 Request are always free per month as part of AWS Free Usage Tier (Global-Catalog-Request)", "forecastedUsageAmount": 2224.25, "freeTierType": "Always Free", "limit": 1000000.0, "operation": "Request", "region": "global", "service": "AWS Glue", "unit": "Request", "usageType": "Catalog-Request" }, { "actualUsageAmount": 176.36827958, "description": "1000000.0 Obj-Month are always free per month as part of AWS Free Usage Tier (Global-Catalog-Storage)", "forecastedUsageAmount": 1366.8541667450002, "freeTierType": "Always Free", "limit": 1000000.0, "operation": "Storage", "region": "global", "service": "AWS Glue", "unit": "Obj-Month", "usageType": "Catalog-Storage" } ] }
例 示例:查找您的 Amazon Elastic Compute Cloud 免费套餐优惠

以下 Amazon CLI 命令使用 GetFreeTierUsage API 操作,来按 Amazon EC2 免费套餐使用情况进行筛选。

请求

aws freetier get-free-tier-usage --filter '{"Dimensions": {"Key": "SERVICE", "Values": ["EC2"], "MatchOptions": ["CONTAINS"]}}'

响应

以下响应返回了来自 Amazon EC2 的两个 12 Months Free 优惠。

{ "freeTierUsages": [ { "actualUsageAmount": 15.97777618, "description": "30.0 GB-Mo for free for 12 months as part of AWS Free Usage Tier (Global-EBS:VolumeUsage)", "forecastedUsageAmount": 23.96666427, "freeTierType": "12 Months Free", "limit": 30.0, "operation": "", "region": "global", "service": "Amazon Elastic Compute Cloud", "unit": "GB-Mo", "usageType": "EBS:VolumeUsage" }, { "actualUsageAmount": 750.0, "description": "750.0 Hrs for free for 12 months as part of AWS Free Usage Tier (Global-BoxUsage:freetier.micro)", "forecastedUsageAmount": 1125.0, "freeTierType": "12 Months Free", "limit": 750.0, "operation": "RunInstances", "region": "global", "service": "Amazon Elastic Compute Cloud", "unit": "Hrs", "usageType": "BoxUsage:freetier.micro" } ] }

Amazon CLI 和 Amazon 软件开发工具包(SDK)包括对 Free Tier API 的支持。有关支持 Free Tier API 的语言列表,请选择该操作名称,然后在另请参阅部分中,选择您的首选语言。

有关使用 Free Tier API 的更多信息,请参阅 Amazon Billing and Cost Management API Reference

要使用 Amazon Billing and Cost Management 控制台跟踪您的免费套餐使用情况,例如接收电子邮件提醒,请参阅 跟踪您的 Amazon Web Services 中国区免费套餐 使用量

有关使用 Amazon EC2 的免费套餐的更多信息,请参阅《Amazon EC2 用户指南(适用于 Linux 实例)》中的 教程:Amazon EC2 Linux 实例入门

您还可以创建 Amazon 成本预算,然后设置在成本和使用量超出或预测会超出预算时收到通知和提醒。有关更多信息,请参阅《Amazon 成本管理用户指南》中的 Managing your costs with Amazon Budgets