Piggy bank breaking open.
Breaking the Bank

AWS Without Breaking the Bank

Imagine you are following along in an online tutorial that will walk you through creating a cloud-based API to serve up some data from an AWS EC2 instance, connected to a database. You complete the tutorial and end up with this great API. You decide to share it with your friend who will “ohh and ahh” at your site. A month later you get an email from AWS that mentions a bill is due. To your surprise, the bill is over $300. WHAT? HOW? No way! What do I do now? How do I keep this from happening ever again?

In this article, I’ll offer the essential guidance you need to keep this from happening to you (again?).

I’m sure this scenario is not foreign to many of you. AWS is hugely popular because of its “metered billing”, charging you just for what is turned on, but is also dangerous because the meter may be running even if we aren’t using the resources. Many seasoned professionals (myself included) have experienced surprise charges, spiking bills, and run-away resources.

The easy answer is to say, “Be sure to turn everything off after the tutorial,” and hopefully most tutorials say at least this. But sometimes we just plain forget, or want to show it off again later, then forgetting to stop the services. In either case, I have a great AWS built-in solution to talk about that can help you manage your spending at AWS: the billing page.

I will step you through creating a trigger that, once you hit 10 dollars, will alert you via email. There are other options that are available to you such as text for notification. There are also options that have the ability to shut down some of the services (but we will not cover that in this tutorial).

  1. Log into your AWS Console.
  2. From the search menu at the top, search for budgets. Find and select “AWS Budgets”.
  1. The Overview pages will show any budgets you have set up.
  2. We will create our first alert at $10.00. Select the “Create budget” button.
  1. From the Budget types select “Cost budget”, then click Next.
  1. Next we will set some flags. I will go through a single set, but please research and explore the other options. Scroll down a little to the “Set budget amount”, then:
  • From the period dropdown select “Monthly”.
  • Click the radio button for “Recurring budget” (which will bill month-to-month).
  • Select the month you want to start.
  • Click the radio button for “Fixed”.
  • Finally enter the amount you want to track. (Eg: 10.00)
  • There is some additional information in the budget scope (we will scroll past this).
  • At the very bottom give your budget a name, like “10 Dollars per month”.
  • Click next.
  • You can manage different percentages of the amount that you set by clicking “Add an alert threshold”.
  • For this example, we will do 1 alert. Put “100%” as the threshold and put “Actual” as the trigger.
  • Add your email to the email recipients.
  • You can add optional SNS alerts and chatbot alerts (we will skip this as well).
  • Click Next.
  • The next page will show you an overview of your alerts.
  • Press Next.

The last page will be an overview of your selected options. You can adjust them as needed. When you are finished, click on “Create budget”.

And you are all set! You should now get alerted to how much your AWS account is racking up if you’ve left something running. Pay close attention to those alerts, and be ready to shut down services if you are getting charged more than you like.

If you are looking to dive deeper into what budgets can do, be sure to look at budget actions. When you hit set thresholds, you could shut down services or remove instances. This does take some additional setup steps like setting up an IAM user with specific permissions. This will be a fun and rewarding ‘rabbit hole’ to dive into.

Originally published at https://www.codefellows.org.

--

--

--

Learn to Code. Get a Job. Start Here! Learn more at www.codefellows.org

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Setting Up Seed Ubuntu on VirtualBox

Kin Developer Program Apps — Live in Week 1

Using Jenkinsfile approach (GROOVY) to deploy a webpage on top of Kubernetes

A. Amazon Web Services

CS371p Spring 2022: Joshua Cho

Git for n00bs using GitHub and cmd (hands-on tutorial)

It’s time to kill the web

Fractal Tasks and the Journey through the Forest of the Infinite.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Code Fellows

Code Fellows

Learn to Code. Get a Job. Start Here! Learn more at www.codefellows.org

More from Medium

Running Shiny in AWS Fargate

Getting Started With Amazon Athena

How to create a bucket in AWS and host a static website on AWS S3.

Setting up a Lightsail Static IP Address from Dynamic IP Address.

Amazon Lightsail Part4 by clickaws.com