Mobile Monitoring Solutions

Search
Close this search box.

AWS Exposes Free Tier API to Help Developers Avoid Unexpected Bills

MMS Founder
MMS Renato Losio

Article originally posted on InfoQ. Visit InfoQ

AWS has recently introduced a Free Tier API allowing developers to check their AWS Free Tier usage and monitor progress toward the free tier limits. This API can be accessed directly through the AWS CLI or integrated into applications using the SDKs, reducing the chance of unexpected bills.

The new GetFreeTierUsage API provides the same information available on the Free Tier page but with a structured format that can be parsed programmatically. Danilo Poccia, chief evangelist (EMEA) at AWS, writes:

Previously, the Free Tier API was not publicly available and was used internally for the Free Tier page in the AWS Billing console, where you can find the same data. We hope that making the GetFreeTierUsage API publicly available can help you have fun with AWS, have better use of the AWS Free Tier offers, and be aware of what is free and what to do when you get close to or over a limit.

The so-called Free Tier includes three distinct types of AWS offerings which are indicated in the API’s freeTierType field, ‘Always Free‘ offers permit customers to use a service at no cost, up to specified limits, and without time constraints. ‘12 Months Free‘ offers enable customers to use a service for one year from the date the account was activated. ‘Free Trial‘ short-term trial offerings. The new API is available using the CLI:

aws freetier get-free-tier-usage

The response is a JSON document containing a description of the current usage for each offer that applies to the account during the billing period. For example:

{
	"actualUsageAmount": 3.90725671,
	"description": "1000000.0 Obj-Month are always free per month as part of AWS Free Usage Tier (Global-Catalog-Storage)",
	"forecastedUsageAmount": 8.651782715,
	"freeTierType": "Always Free",
	"limit": 1000000.0,
	"operation": "Storage",
	"region": "global",
	"service": "AWS Glue",
	"unit": "Obj-Month",
	"usageType": "Catalog-Storage"
}

Poccia explains:

Three interesting properties are the limit of the offer (limit), the actual usage amount of the offer (actualUsageAmount), and the forecasted usage amount (forecastedUsageAmount) at the end of the billing period (the current month). They are all based on the unit used by the offer. For example, the Windows and Linux compute offers each have a limit of 750 hours per month.

The API also provides forecasted usage, with the option to filter for offers for which the forecast is greater than the limit and that can potentially generate a bill:

aws freetier get-free-tier-usage --query 'freeTierUsages[?forecastedUsageAmount > limit]'

However, once the limit is reached, the actual usage is no longer tracked by the GetFreeTierUsage API, and the corresponding offer is not returned.

In the last few years, there have been growing concerns among developers about the AWS Free Tier, with developers questioning why the cloud provider did not implement safety barriers to avoid unexpected charges. AWS now offers multiple options to monitor the usage of the Free Tier providing default alerts in the AWS Billing and Cost Management console that send emails when the usage exceeds 85 percent of the Free Tier limit and the ability to create a zero-spend budget in the Budgets section.

While the new Free Tier API will simplify monitoring, AWS still does not provide a spending limit functionality like Azure or the ability to explicitly enable billing like Google Cloud.

Poccia released a sample Python script on GitHub to get an overview of current usage, limits, and forecasted usage at the end of the billing period for each offer.

About the Author

Subscribe for MMS Newsletter

By signing up, you will receive updates about our latest information.

  • This field is for validation purposes and should be left unchanged.