Maksim Kabakou - Fotolia

Tip

Implement AWS billing alerts to stay on budget

AWS offers compute power at your fingertips, but cloud resources can quickly drive up costs if users aren't careful. Stay within your budget with AWS billing alarms and metrics.

Even rudimentary AWS deployments rely on more than one cloud component. For example, if you host your company's site on AWS, you probably use load balancers to route traffic to at least two EC2 instances, store files in an S3 bucket and secure sensitive user data in a database that might span multiple availability zones.

While tools like Amazon CloudWatch help you monitor these compute, storage and network resources, it also offers functionality that's equally important in these multiservice deployments: AWS billing alerts and metrics.

Let's say one of your developers leaves a pricy EC2 instance running for months, or that you misconfigure your Auto Scaling policies. These can both generate extra and completely unnecessary costs. Follow these tips to set up AWS billing alerts and track your cloud spend.

Track free-tier usage

AWS will almost always inform you when you provision a service that's compatible with its free tier. For example, when you provision an EC2 instance, AWS will highlight the exact type that's eligible for the tier, such as the t2.micro.

EC2 instances available in the free tier of service.
When you choose an instance type, AWS indicates which ones fit within the free tier of service.

But the account settings can be even more helpful. Click on your login name in the top right corner of the AWS Management Console; select My Account; then, on a newly opened page, go to Preferences.

Set up free tier usage alerts.
Within the AWS Management Console, you can establish alerts to stay with the AWS Free Tier.

Enable Receive Free Tier Usage Alerts, and enter your email to receive notifications every time you provision a service outside the scope of the AWS Free Tier. You can also monitor your AWS Free Tier limits through the dashboard on the billing homepage.

Use AWS Budgets

Although it's still unfamiliar to many AWS users, you can find AWS Budgets in your account settings. Here, you can do the following:

  • Select a name for your budget, the amount and how long you want to monitor this budget alarm.
  • Refine your budget by region or availability zone, instance and service types, tags or other custom filters.
  • Set up notifications, which can include email, text or Simple Notification Service (SNS) topics that can export alerts to a messaging service, such as Slack.

With AWS Budgets, you can track your expenditures in comparison to your budget, including Reserved Instance utilization, data transfer charges and S3 consumption.

Set billing, service thresholds

To set up billing notifications, enable Receive Billing Alerts in your account preferences. Next, navigate to CloudWatch and select Billing under the Alarms navigation bar. Here, you can create several alarms with desired threshold values. If the costs reach the threshold, you will be notified by email or an SNS topic.

Not only can you set overall billing thresholds, you can define them per service. It's a good idea to create several AWS billing alerts. For example, one alert can notify you when you reach about 50% of your average monthly cost for a service, and a second alert can inform you when you're near full-month usage. You can set additional notifications to highlight limits of what you are -- or aren't -- willing to pay. Always be sure to adjust the values from time to time, depending on your usage.

Automate AWS Cost and Usage Reports

If AWS billing alerts aren't sufficient, you can set up daily or even hourly AWS Cost and Usage Reports. First, create a report. Pick a name for the report, select the time schedule, choose optional analysis via Amazon Redshift or QuickSight and select an S3 bucket to store the saved reports.

To fully automate the reports, create a simple AWS Lambda function to monitor the S3 bucket. When a new file uploads to the bucket, it will send you an email notification with that file as an attachment. Additionally, you could opt to tie in an open source tool to analyze reports.

Integrate CloudWatch billing metrics

Email notifications are helpful, but email messages can pile up, and engineers might not read them. That's why you should integrate CloudWatch billing metrics with your preferred monitoring tool. Almost all popular hosted and SaaS monitoring vendors -- such as Datadog, Hosted Graphite and New Relic -- support CloudWatch billing metrics, and installation is typically easy and straightforward.

Aside from these tips, don't forget to run AWS Cost Explorer from time to time to audit your costs. If you have Business or Enterprise Support plans, you can also use the full version of AWS Trusted Advisor to pinpoint every cent of your AWS bill.

Dig Deeper on AWS management

App Architecture
Cloud Computing
Software Quality
ITOperations
Close