DEV Community

Cover image for 8 Effective Tips to Reduce Your EC2 Spending
jameslaneovermind
jameslaneovermind

Posted on • Originally published at overmind.tech

8 Effective Tips to Reduce Your EC2 Spending

Introduction

If you're running a business that relies heavily on Amazon EC2, you're probably well aware of the costs that come along with it. Cloud infrastructure can be expensive, and EC2 is no exception. However, there are a number of proven best practices that you can implement to help reduce your EC2 spending. In this article, we'll explore those practices in detail.

1. Identify Amazon EC2 instances with low utilisation and reduce cost by stopping or rightsizing‍

One of the most impactful ways to reduce AWS EC2 costs is to right-size your instances.

  • Use AWS Cost Resource Optimization to get a report of EC2 instances that are either idle or have low utilisation.
  • Reduce costs by either stopping or downsizing these instances.
  • Use AWS Instance Scheduler to automatically stop instances.
  • Use AWS Operations Conductor to automatically resize the EC2 instances (based on the recommendations report from Cost Explorer).
  • Use AWS Compute Optimizer to look at instance type recommendations beyond downsizing within an instance family. ‍ ### 2. Use Compute Savings Plans to reduce EC2, Fargate and Lambda costs‍

Compute Savings Plans automatically apply to EC2 instance usage regardless of instance family, size, AZ, region, OS or tenancy, and also apply to Fargate and Lambda usage.

  • Use one year, no upfront Compute Savings Plans to get a discount of up to 54% compared to On-Demand pricing.
  • Use the recommendations provided in AWS Cost Explorer, and ensure that you have chosen compute, one year, no upfront options.
  • Once you sign up for Savings Plans, your compute usage is automatically charged at the discounted Savings Plans prices. ‍

3. Use Amazon EC2 Spot Instances for AWS Cost Reduction‍

If your workload is fault-tolerant, using Spot Instances can reduce EC2 costs by up to 90% and is a key strategy for AWS cost reduction.

The main caveat is that spot instances can be interrupted at two minutes’ notice.

Examples of typical workloads include big data, containerised workloads, CI/CD, web servers, and development/testing.

Amazon provides the Spot Fleet feature, which lets you run both on-demand and spot instances in the same Auto Scaling group, letting you reserve some on-demand instances which cannot be interrupted, for critical components.

4. Analyse and attribute expenditure‍

Clouds can help you accurately identify the cost and usage of systems, allowing transparent attribution of IT costs to the individual workload owners.

It enables you to measure return on investment (ROI) and helps workload owners optimise resources and reduce costs.

5. Use the latest instance types‍

Switching your EC2 Instance to the latest Instance types can reduce AWS cost up to 6%. This is because they typically provide higher efficiency or better performance at a lower price.

6. Purchase reserved instances for a reasonable period of time‍

Simply put, if you don't need an instance, don't keep it longer than necessary.

7. Schedule instances to ensure they run only during business hours or when needed‍

You can achieve this automatically using AWS Instance Scheduler or other tools.

8. Adopt a consumption model‍

AWS recommends paying only for the required computing resources and increasing or decreasing usage according to business needs.

For example, staff typically use development and testing environments eight hours per day during a workweek. You can potentially achieve 75% cost savings by stopping these resources when they are not used.

Conclusion

Reducing AWS EC2 costs is an essential aspect of optimising your cloud infrastructure and maximising your ROI. By implementing these 8 best practices, you can ensure that you’re only spending what you need too.

Top comments (0)