How to optimize your AWS computing costs

Check your instance types and pricing models

Derek Hutson
3 min readAug 17, 2022

One of the beautiful things about cloud computing is that you are in just about complete control of how much money you spend in the cloud. The only thing you can’t really control are the prices that AWS sets on their services and resources. However since one of the biggest benefits of cloud computing is its pay as you go model, you get to decide what types of resources you use, for how long, and how many of them you want.

Generally, your compute, storage, and database resources are what will consume the most of your capital. In here we are going to cover the compute layer because what kind of applications can you run without computing power? My guess is that you would be limited to sticks and stones.

For the sake of this conversation we are going to be mostly focusing on EC2, as it is the most heavily used compute (and overall) service. Although it is important to remember your compute layer could consist of more services such as Batch, Lambda, Beanstalk etc.

When we think about costs in the compute layer of your cloud architecture, we need to be mindful of 2 main areas: instance type and pricing plan.

There are 5 main types of instances.

  1. General purpose, which are best used in dev/test environments and for small to medium database workloads. This is also generally the cheapest option.
  2. Compute optimized, which are needed for workloads requiring low latency and high streaming capacity for gaming, video editing etc.
  3. Memory optimized, used for high in memory workloads and for processing large sets of unstructured data.
  4. Storage optimized, best used for OLAP workloads and log analytics jobs.
  5. Accelerated computing, goes well with machine learning and specific functions.

When you are considering which type of instance to use it is important to also look into the characteristics of each instance, which can impact your costs. For example if we look at a compute optimized instance, do you want to use a C7g.large which comes with 2GiB of memory, or a c5.12xlarge that comes with 96GiB of memory? It depends on what your environment needs to meet your KPIs while also not exceeding budgets.

Another thing to remember is that it is not important to memorize all the instance characteristics, but rather to keep sizing in mind when you are planning out your architecture. As an example it is always going to cost less to buy a cheap laptop from Walmart as opposed to a nice desktop computer, but you get what you pay for.

Next lets keep pricing models in mind, which there are 4 of:

  1. Spot instances, which are by far the cheapest pricing model (up to 90% off the on-demand price), however they are susceptible to interruptions while processing workloads. These are great for batch workloads for example.
  2. On-Demand, which involves paying by the hour or second of usage (depending on what instances you run). Recommended for testing or when you don’t want to commit and pay upfront.
  3. Reserved instances, recommended if you know you are going to be needing some compute resources for at least a year. You can do a partial or full upfront payment to save some or more money, respectively.
  4. Dedicated hosts, which are physical EC2 servers reserved for your use. If you have server-bound software licenses, or compliance requirements, you are going to need these.

The pricing plans are a little more straightforward than the instance types because there are really only 4 of them, however there are definitely some fine details you will want to become aware of over time. For example if you paid in full upfront for some reserved EC2 instances and discover you no longer need them, you can turn around and sell them on AWS marketplace to save some of your money.

Conceptually it is pretty simple to save money on your compute workloads in your cloud environment. But the more experience you have with something then over time you become better at using it and figuring out the fine details that make big differences. I have recommended Cloud Academy before to learn more about AWS, but if you want to go straight to the source AWS offers AWS Educate which is completely free.

Good luck on your continued journey in learning Cloud Computing.

--

--

Derek Hutson
Derek Hutson

Written by Derek Hutson

Practicing Kaizen in all things. Being a dad is pretty neat too.

No responses yet