0
0
AWScloud~5 mins

Free tier usage monitoring in AWS - Commands & Configuration

Choose your learning style9 modes available
Introduction
Free tier usage monitoring helps you keep track of how much of the free resources you have used on AWS. This prevents unexpected charges by alerting you before you go over the free limits.
When you start using AWS services and want to avoid surprise bills.
When you run small projects or tests that fit within the free tier limits.
When you want to learn AWS without paying for extra usage.
When you manage multiple AWS accounts and want to monitor free tier usage centrally.
When you want to receive alerts if your usage approaches or exceeds free tier limits.
Commands
This command fetches your AWS free tier usage for May 2024, showing how much of the free resources you have used this month.
Terminal
aws ce get-free-tier-usage --time-period Start=2024-05-01,End=2024-05-31 --granularity MONTHLY
Expected OutputExpected
{ "FreeTierUsage": [ { "Service": "AmazonEC2", "UsageQuantity": 10, "UsageUnit": "Hours" }, { "Service": "AmazonS3", "UsageQuantity": 5, "UsageUnit": "GB-Months" } ] }
--time-period - Specifies the start and end dates for the usage data.
--granularity - Sets the data detail level; MONTHLY shows total usage per month.
This command creates a budget alert that emails you when your free tier usage costs for EC2 and S3 reach 80% of $15 in a month.
Terminal
aws budgets create-budget --account-id 123456789012 --budget '{"BudgetName":"FreeTierUsageAlert","BudgetLimit":{"Amount":"15","Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST","CostFilters":{"Service":["AmazonEC2","AmazonS3"]}}' --notifications-with-subscribers '[{"Notification":{"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN","Threshold":80,"ThresholdType":"PERCENTAGE"},"Subscribers":[{"SubscriptionType":"EMAIL","Address":"user@example.com"}]}]'
Expected OutputExpected
{"Budget":{"BudgetName":"FreeTierUsageAlert","BudgetLimit":{"Amount":"15","Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST"}}
--budget - Defines the budget details like name, limit, and services.
--notifications-with-subscribers - Sets up alert notifications and who receives them.
This command lists all budgets set up in your AWS account to verify your free tier usage alerts.
Terminal
aws budgets describe-budgets --account-id 123456789012
Expected OutputExpected
{"Budgets":[{"BudgetName":"FreeTierUsageAlert","BudgetLimit":{"Amount":"15","Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST"}]}
--account-id - Specifies the AWS account to check budgets for.
Key Concept

If you remember nothing else from this pattern, remember: monitoring your free tier usage with AWS Cost Explorer and Budgets helps avoid unexpected charges.

Common Mistakes
Not specifying the correct time period in the usage command.
You might get no data or data for the wrong dates, missing your actual usage.
Always set the --time-period flag with the correct start and end dates for the usage you want to check.
Creating a budget without notification subscribers.
You won't receive alerts, so you might miss when usage approaches limits.
Include notification subscribers with valid email addresses to get alerts.
Using the wrong AWS account ID in budget commands.
Budgets won't apply to your intended account, so alerts won't work.
Double-check and use the correct AWS account ID for your budgets.
Summary
Use 'aws ce get-free-tier-usage' to check your current free tier usage for specific dates.
Create budgets with 'aws budgets create-budget' to set cost limits and receive alerts.
Verify your budgets with 'aws budgets describe-budgets' to ensure alerts are active.