Six Ways to Cut Costs with EC2

Tim Schill
AWS Specialists
Published in
4 min readApr 12, 2023

AWS EC2, or Amazon Elastic Compute Cloud, is incredibly powerful and one of the most widely used cloud computing services. The right optimization can help you cut costs without sacrificing performance.

Here are six ways you can cut costs with EC2.

1. Rightsizing

The first step to cost optimization is ensuring you are running the right instance type for your workload. Rightsizing involves choosing the right instance type and the right instance size to meet the performance requirements of your workload. When done right and all your workloads run on optimized instances that aren’t wasting resources, you can likely cut costs by around 20–30%.

AWS provides excellent tools to help with rightsizing, such as AWS Compute Optimizer or Trusted Advisor. We also want to remind you of the importance of resizing your instances with the latest version of the instance type. For example, if you are currently running a bunch of m5.2xlarge instances, see if you can convert these into m6i.2xlarge instances instead. The m6i instance family is priced the same as the m5 family, but it will give you better CPU performance.

AWS Compute Optimizer

2. Closely monitor scheduled instances

Another cost optimization strategy is to schedule instances to turn on and off when not in use. This is especially useful for development and testing environments, which are only needed during working hours. In scenarios where there are predictable scheduled intervals for running compute services, using AWS Instance Scheduler can generate savings of up to 70%.

3. Spot instances

Spot instances are cost-effective for batch workloads, big data and analytics, and other stateless workloads. Spot instances can save you up to 90% of the on-demand price, but know that AWS can take back the instance at any time with a 2-minute notice, making the option best suited for stateless workloads. One of the best things about this? You can use spot instances and on-demand instances in conjunction with each other.

Spot instance pricing history

4. Optimizing Auto Scaling Groups (ASG)

Another way to optimize costs is by using auto scaling groups, or ASG for short. ASG can automatically adjust the number of instances in your fleet based on demand. You can also configure ASG to use spot instances when needed, resulting in further cost savings. There is no additional charge for AWS Auto Scaling. You only pay for the AWS resources needed to run your applications and Amazon CloudWatch monitoring fees.

Instances in our auto scaling group

5. Reserved instances & Compute Savings Plans

One of the ways to cut costs with EC2 involves using reserved instances or compute savings plans. Reserved instances give you a discount of up to 72% on your instances and provide a more predictable cost structure. Compute savings plans offer a similar discount (up to 62%) but with more flexibility, covering not only EC2 instances but also Lambda and Fargate.

Purchase reserved instances

6. Amazon Graviton

Our sixth and final recommendation for ways to cut costs with EC2 involves using Amazon Graviton and the ARM architecture, which is generally less expensive than x86 processors and optimized for cloud workloads, and can be easily scaled as needed through AWS.

Leaping to Graviton can be a bigger task since you need to do more than just convert the instances. In order to be able to run Graviton, you have to compile your application for the ARM64 architecture. If you also rely on third-party dependencies in your application, you must ensure that these also support ARM64.

Once you have converted your workloads to ARM64, you can expect up to 40% better price performance than the Intel-based instances. Meaning you will not only get a lower price, but you will also receive better CPU performance out of the same amount of cores in your instances. You can use Graviton for your RDS and Elasticache instances as well if you meet the requirements, typically being on the supported version of the database engine. We recommend running Graviton wherever possible for performance and cost savings.

Wrap-up

In addition to these six strategies, there are several other ways to optimize costs with EC2, such as optimizing EBS volume size and IOPS reservations, switching from GP2 to GP3 volumes, cleaning up unused AMI and snapshots, and removing unused Elastic IPs.

Now, what are your ways to cut EC2 costs? I would love to hear about it!

--

--