Three ways to reduce your AWS bill
Although reducing the costs associated with running your workloads in AWS has always been an essential part of day-to-day operations, it can sometimes fall to the bottom of the list when times are good. The current economic situation has changed how many of our customers approach how they spend their money in AWS, from an afterthought to the forefront.
In this article, I wanted to provide you with some simple things you can do immediately to help reduce your monthly AWS spending.
Although serverless continues to be the darling of the cloud, in our experience many of our customers continue to run virtual machines in AWS (EC2 instances) and will continue to run this type of workload for the foreseeable future, so I’ve written the article in that context.
Let’s jump in.
Turn off EC2 instances when they are not in use
Since you pay for every hour (or minute) an EC2 instance (virtual machine) is running in AWS, it’s super important that if they are not in use you consider either 1) turning them off or 2) terminating them.
How you decide between the two options is up to you, but a basic question you can ask yourself could be: Do you intend to use this instance again shortly? If the answer is yes, I’d suggest you simply turn it off until you need it again. Otherwise, consider terminating it.
Remember, if you decide to terminate an EC2 instance, you can not recover it, so you may want to take a snapshot of the instance before you terminate it - just in case.
Once you’ve decided a path forward - terminate or turn things off - you need to figure out how to best accomplish your goal and the business rules you’ll use to determine what to do and when.
In this article, we won’t get into the technical details of how you might accomplish this, but here’s a real-life example
for one of our customers. Our customer has a large EC2-based development environment that, at the time, was running 24x7.
To reduce costs, they asked us to turn off all the development machines outside regular business hours (defined as 8 AM - 8 PM ET M-F).
We automated this using a couple of simple Lambda functions and Event Bridge and reduced the customer’s monthly EC2 spending by approximately 50%.
Right-size your EC2 instances to avoid overpaying
If you’re not able to terminate or stop your EC2 instances - say they are running production workloads - you should make sure you’re using the right tool for the job. The easiest way to do this is with AWS Compute Optimizer.
Getting started with AWS Compute Optimizer couldn’t be easier. You simply opt in, and you’re all set. There are a couple
of items to keep in mind - first, AWS Compute Optimizer supports AWS Organizations, so if you manage multiple AWS accounts
via Organizations, I suggest enabling Compute Optimizer across all your accounts by turning on trusted access in AWS Organizations.
Next, to get a clear picture of utilization, you should install the CloudWatch agent on each of your EC2 instances so that
the service can use memory utilization data. Without this information, the service won’t completely understand how your
EC2 instances are being used.
Once you’ve enabled Compute Optimizer, it’ll take at least 30 consecutive hours of CloudWatch data before making any recommendations.
After the analysis is complete, you’ll get recommendations which may help reduce your EC2 costs by downsizing your EC2 instances.
As a bonus, Compute Optimizer also supports Elastic Block Store (EBS), Elastic Container Service (ECS) for Fargate, and Lambda functions.
Check your backup plans
If you’re running EC2 workloads, you are backing them up (regularly) - right? Remember the ‘Shared Responsibility Model’; it will save you countless times.
Since we’re protecting our data regularly by backing up our EC2 instances and EBS volumes, we know our costs will slowly creep up because of the additional storage.
If you’re using AWS Backup, you should review your backup plans to ensure that you’re not keeping more data than required.
If you’ve built something custom (or are using a 3rd party solution), you should also review to ensure everything is relevant.
Consider purchasing a Savings Plan or Reserved Instances
Finally, once you’ve determined the EC2 workloads that need to be running all the time, and you’ve completed at least one round of right-sizing, you may want to consider making a commitment to AWS by purchasing either a Savings Plan or Reserved Instances (RI) to further reduce your AWS bill - RI can offer good discounts if you sign up for a 1-3 year term.
Note that while committing to this type of billing is an important part of running workloads on the AWS platform, it does reduce the flexibility you enjoy with the default on-demand billing method.
Many of our customers use Savings Plans and/or RI to help manage their bill, however you should consider this step carefully to ensure that it fits with your longer-term plan.