https://aws.amazon.com/blogs/aws/check-your-aws-free-tier-usage-programmatically-with-a-new-api/ Skip to Main Content Click here to return to Amazon Web Services homepage Contact Us Support English My Account Sign In Create an AWS Account * re:Invent * Products * Solutions * Pricing * Documentation * Learn * Partner Network * AWS Marketplace * Customer Enablement * Events * Explore More [ ] Close * `rby * Bahasa Indonesia * Deutsch * English * Espanol * Francais * Italiano * Portugues * Tieng Viet * Turkce * Russkii * aithy * Ri Ben Yu * hangugeo * Zhong Wen (Jian Ti ) * Zhong Wen (Fan Ti ) Close * My Profile * Sign out of AWS Builder ID * AWS Management Console * Account Settings * Billing & Cost Management * Security Credentials * AWS Personal Health Dashboard Close * Support Center * Expert Help * Knowledge Center * AWS Support Overview * AWS re:Post Click here to return to Amazon Web Services homepage Get Started for Free Contact Us [ ] * re:Invent * Products * Solutions * Pricing * Introduction to AWS * Getting Started * Documentation * Training and Certification * Developer Center * Customer Success * Partner Network * AWS Marketplace * Support * AWS re:Post * Log into Console * Download the Mobile App AWS Blog Home Blogs Editions Close Architecture AWS Cloud Operations & Migrations AWS for Games AWS Insights AWS Marketplace AWS News AWS Partner Network AWS Smart Business Big Data Business Intelligence Business Productivity Cloud Enterprise Strategy Cloud Financial Management Compute Contact Center Containers Database Desktop & Application Streaming Developer Tools DevOps Front-End Web & Mobile HPC Industries Integration & Automation Internet of Things Machine Learning Media Messaging & Targeting Microsoft Workloads on AWS .NET on AWS Networking & Content Delivery Open Source Public Sector Quantum Computing Robotics SAP Security Spatial Computing Startups Storage Supply Chain & Logistics Training & Certification Close * Zhong Guo Ban * Ri Ben Ban * hangug edisyeon * gisul beulrogeu * Edisi Bahasa Indonesia * AWS Thai Blog * Edition Francaise * Deutsche Edition * Edicao em Portugues * Edicion en Espanol * Versiia na russkom * Turkce Surum AWS News Blog Check your AWS Free Tier usage programmatically with a new API by Danilo Poccia | on 26 NOV 2023 | in Announcements, AWS Cloud Financial Management, AWS Cost and Usage Report, AWS re:Invent, Billing & Account Management, Launch, News | Permalink | Comments | Share * * * * * [https://aws.amazon.c] Voiced by Polly Starting today, you can check your usage of the AWS Free Tier using the new AWS Free Tier API. You can use the API directly with the AWS Command Line Interface (AWS CLI) or integrate it into an application with the AWS SDKs. The AWS Free Tier program provides you with the ability to explore and try out AWS services free of charge up to specified limits for each service. The AWS Free Tier includes three different types of offerings: * Always free offers allow customers to use a service for free up to specified limits as long as they are an AWS customer. * 12 months free offers allow customers to use a service for free up to specified limits for one year from the date the account was activated. * Short-term trials are free to use for a specified period or up to a one-time limit, depending on the service. Once you begin turning on AWS resources and interacting with AWS services that offer a free tier, you need to keep track of your progress toward the free tier limit so that you know when to expect to switch to pay-as-you-go pricing. There are a few ways you can keep track of your AWS Free Tier usage: * The usage alerts in the Billing preferences of the AWS Billing and Cost Management console are enabled by default (unless the account was created via AWS Organizations) and send you emails when you exceed 85 percent of the Free Tier limit for each service. * You can create a zero-spend or a monthly-cost budget in the Budgets section of the Billing and Cost Management console. Using templates, it just requires a couple of clicks and the email address to notify. * The Free Tier page in the Billing and Cost Management console tells you the service, the type of offer, the current usage, and the forecasted usage for each offer in the current billing period. * The new GetFreeTierUsage API provides the same information in the Free Tier page with a structured format that you can use programmatically. Let's see how this new API works in practice. Using the AWS Free Tier API with the AWS CLI I got access to a new account created in the last few months. Here, I use the AWS Command Line Interface (AWS CLI) to call the GetFreeTierUsage API. aws freetier get-free-tier-usage The response is a JSON document that contains a description of the current usage for each offer that is applicable to this account during this billing period. For simplicity, I only show a few offers here. { "freeTierUsages": [ { "service": "Amazon Simple Queue Service", "operation": "", "usageType": "Requests", "region": "global", "actualUsageAmount": 294387.0, "forecastedUsageAmount": 679354.6153846154, "limit": 1000000.0, "unit": "Requests", "description": "1000000.0 Requests are always free per month as part of AWS Free Usage Tier (Global-Requests)", "freeTierType": "Always Free" }, { "service": "Amazon Elastic Compute Cloud", "operation": "", "usageType": "EBS:VolumeUsage", "region": "global", "actualUsageAmount": 9.0, "forecastedUsageAmount": 33.0, "limit": 30.0, "unit": "GB-Mo", "description": "30.0 GB-Mo for free for 12 months as part of AWS Free Usage Tier (Global-EBS:VolumeUsage)", "freeTierType": "12 Months Free" }, { "service": "Amazon Elastic Compute Cloud", "operation": "RunInstances:0002", "usageType": "BoxUsage:freetier.micro", "region": "global", "actualUsageAmount": 476.0, "forecastedUsageAmount": 851.0, "limit": 750.0, "unit": "Hrs", "description": "750.0 Hrs for free for 12 months as part of AWS Free Usage Tier (Global-BoxUsage:freetier.micro)", "freeTierType": "12 Months Free" }, { "service": "Amazon Elastic Compute Cloud", "operation": "RunInstances", "usageType": "BoxUsage:freetier.micro", "region": "global", "actualUsageAmount": 225.0, "forecastedUsageAmount": 485.0, "limit": 750.0, "unit": "Hrs", "description": "750.0 Hrs for free for 12 months as part of AWS Free Usage Tier (Global-BoxUsage:freetier.micro)", "freeTierType": "12 Months Free" }, { "service": "Amazon Redshift", "operation": "RunComputeNode:0001", "usageType": "Node:dc2.large", "region": "global", "actualUsageAmount": 367.0, "forecastedUsageAmount": 735.0, "limit": 750.0, "unit": "Hrs", "description": "750.0 Hrs for free per month during a short-term trial as part of AWS Free Usage Tier (Global-Node:dc2.large)", "freeTierType": "Free Trial" }, ... ] } In the freeTierUsages list, I find some of the most common offers: * Two compute offers for Amazon Elastic Compute Cloud (Amazon EC2). + The offer with operation RunInstances:0002 is for Windows. + The offer with operation RunInstances is for Linux. + The value of the operation property is the same as the platform details and usage operation displayed on the Instances or AMIs pages in the Amazon EC2 console. For more information, see the AMI billing information fields in the Amazon EC2 User Guide. * One storage offer for Amazon Elastic Block Store (Amazon EBS) volumes. This and the two Amazon EC2 compute offers have freeTierType equal to 12 Months Free. * An Always Free offer for Amazon Simple Queue Service (Amazon SQS) . * A Free Trial (short-term) offer for Amazon Redshift. Let's have a look at some properties of these offers: * description gives a readable explanation of what the offer is about. * freeTierType tells the type of offer: Always Free, 12 Months Free, or Free Trial (short-term). * unit describes the unit used to measure usage for the offer. For example, Hrs (hours) for EC2 instances, GB-Mo (GB per month) for EBS volumes, Requests for Amazon SQS, and so on. 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. For the storage offer, the limit is 30 GB per month. For Amazon SQS, the limit of the offer is one million requests per month. Details on the limits and services provided for free are detailed in each card on the AWS Free Tier page and on the pricing page of each service. The actual and forecast usage amounts provided by the AWS Free Tier API are estimated up to three times per day, similar to AWS Cost and Usage Reports. If the forecast usage is greater than the limit for the offer, I should expect to switch to pay-as-you-go pricing before the end of the billing period if I continue to use the service in the same way. Actual usage is no longer tracked by the GetFreeTierUsage API once the limit is reached. This means that the actual usage amount cannot be greater than its limit. If that's the case, the corresponding offer is not returned by the API. For example, I look for the offers for which the forecast is greater than the limit using the --query option of the AWS CLI: aws freetier get-free-tier-usage --query 'freeTierUsages[?forecastedUsageAmount > limit]' { "freeTierUsages": [ { "service": "Amazon Elastic Compute Cloud", "operation": "", "usageType": "EBS:VolumeUsage", "region": "global", "actualUsageAmount": 9.0, "forecastedUsageAmount": 33.0, "limit": 30.0, "unit": "GB-Mo", "description": "30.0 GB-Mo for free for 12 months as part of AWS Free Usage Tier (Global-EBS:VolumeUsage)", "freeTierType": "12 Months Free" }, { "service": "Amazon Elastic Compute Cloud", "operation": "RunInstances:0002", "usageType": "BoxUsage:freetier.micro", "region": "global", "actualUsageAmount": 476.0, "forecastedUsageAmount": 851.0, "limit": 750.0, "unit": "Hrs", "description": "750.0 Hrs for free for 12 months as part of AWS Free Usage Tier (Global-BoxUsage:freetier.micro)", "freeTierType": "12 Months Free" } ] } According to this result, if I want to stay within the Free Tier limits, I can check how I use EBS volumes and Amazon EC2 compute with Windows. For example, I am currently using 476 hours out of the 750 available in a month for Windows EC2 instances. At this pace, I am forecasted to cross the limit and reach about 851 hours. If I am concerned by the costs, I can switch off my Windows instances when not in use or during the night. Things to know 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. Using this information, you can build custom reporting that meets your business needs. For example, if you want to avoid compute costs, you can programmatically stop or hibernate your EC2 instances or set the size of an EC2 Auto Scaling group to zero. You can use any of the AWS SDKs to create a web app or integrate this data in a monitoring solution. More generally, you can send additional emails or notifications (for example, using Amazon SES or Amazon SNS) when the usage of an offer is close to its limit. This can help you get the maximum benefit of an offer without incurring additional costs. You can also do this with AWS Budgets if you set a usage budget amount to the Free Tier limit. If an offer is no longer applicable to this account (for example, because it expired at the end of the previous month), the corresponding item is not included in the list. If you save the results from previous invocations of the API, you can compare the list of offers with those reported during the previous billing cycle to see which offers have recently expired. To learn more about keeping track of your AWS Free Tier usage, we created these three 10-minute courses on AWS Skill Builder, an online learning center where you can learn from AWS experts and build cloud skills online: * AWS Free Tier: Introduction to Offerings * AWS Free Tier: Introduction to Monitoring Services * AWS Free Tier: Introduction to Managing Services -- Danilo Danilo Poccia Danilo Poccia Danilo works with startups and companies of any size to support their innovation. In his role as Chief Evangelist (EMEA) at Amazon Web Services, he leverages his experience to help people bring their ideas to life, focusing on serverless architectures and event-driven programming, and on the technical and business impact of machine learning and edge computing. He is the author of AWS Lambda in Action from Manning. Comments View Comments Resources * Getting Started * What's New * Top Posts * Official AWS Podcast * Case Studies --------------------------------------------------------------------- Follow * Twitter * Facebook * LinkedIn * Twitch * RSS Feed * Email Updates Sign In to the Console Learn About AWS * What Is AWS? * What Is Cloud Computing? * AWS Inclusion, Diversity & Equity * What Is DevOps? * What Is a Container? * What Is a Data Lake? * What is Generative AI? * AWS Cloud Security * What's New * Blogs * Press Releases Resources for AWS * Getting Started * Training and Certification * AWS Solutions Library * Architecture Center * Product and Technical FAQs * Analyst Reports * AWS Partners Developers on AWS * Developer Center * SDKs & Tools * .NET on AWS * Python on AWS * Java on AWS * PHP on AWS * JavaScript on AWS Help * Contact Us * Get Expert Help * File a Support Ticket * AWS re:Post * Knowledge Center * AWS Support Overview * Legal * AWS Careers Create an AWS Account Amazon is an Equal Opportunity Employer: Minority / Women / Disability / Veteran / Gender Identity / Sexual Orientation / Age. * Language * `rby * Bahasa Indonesia * Deutsch * English * Espanol * Francais * Italiano * Portugues * Tieng Viet * Turkce * Russkii * aithy * Ri Ben Yu * hangugeo * Zhong Wen (Jian Ti ) * Zhong Wen (Fan Ti ) * Privacy * | * Site Terms * | * Cookie Preferences * | * (c) 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.