DEV Community

Totalcloud.io
Totalcloud.io

Posted on

Helpful Tips For EC2 Rightsizing

Rightsizing and Its Effects on Cost Optimization
Rightsizing is the definitive method to save costs on AWS EC2 or RDS instances and it is achieved by ensuring that your employed machines are all exactly what is needed to meet the capacity requirement and performance of the workloads. Nothing more, nothing less.

Rightsizing starts with monitoring and analyzing your current services being used. An observation period of at least two weeks or maybe even a month will give you sufficient information on the instance performance and usage patterns while also showing you the peak of your workload.

The metrics that define instance performance include:

vCPU utilization
Memory utilization
Network utilization
Disk usage

What are the steps to Rightsizing an AWS environment?
Chart a plan for your EC2 Project
A project goal is essential in determining beforehand what the resources you need will be. A large cloud environment will be laden with multiple applications, servers, and databases. All these resources will be built upon On-demand, reserved, or spot instances. Without preemptive knowledge, you could invest in machines far beyond your budget limitations.

A lot of teams start out believing that the pay-per-use model saves them from extra expenses because they can maintain the various machines themselves. This couldn’t be further from the truth. And what’s worse, after their realization, they go after reserved instances and commit to durations that end up being too long. The duration of the instances you need depends on the volatility of various aspects of your environment and the shift in workload demands on different occasions.

A plan is essential so you know what goes where and have an idea on the type of resources you need. Eventually, you’ll be able to further break it down to identify the exact machines you require.

At the core of it, it is a basic principle to be aware of what your predictable workloads are so you can equip them with reserved instances. While reserved instances force you to commit to duration, it is both cheaper and if purchased with foreknowledge, you won’t have to worry about rightsizing those instances.

Note: Try to plan your rightsizing a few weeks before the renewal of your reserved instances so you are prepared for your next commitment.

Keep up with the updated generation of instances that pops up so that you might have a cheaper or more powerful alternative to whatever you are looking for.

Choosing the right EC2 Instance
Once you’ve charted the general idea of the resources you’ll need for your initial setup, you can go deeper into the right instances you’ll need for the capacity requirements of your servers, applications, and other parts that make up your environment.

Where do the instances you need for your application fall under? General purpose or compute optimized?
What are your security needs?
What about your storage specs?
What will be the estimated flow of traffic?

Break down all the targets you’ll need to ensure are covered to realize what particular instances you’ll need and do this across the environment.

Analyzing performance data
Analyzing the performance data of your infrastructure will let you pinpoint idle instances or instances with low CPU utilization. These rightsizing opportunities are a result of continuous monitoring. The two factors that you should keep an eye on include CPU usage and memory usage. While Amazon CloudWatch can help you monitor your resources and provide you with reports, you are forced to make the necessary rightsizing changes yourself. You may have come to the conclusion that your CPU is under a constant load of 70-80%, so you are planning to upgrade your machines but this process is entirely manual. Understanding when changes need to happen is easier than figuring out what those changes exactly are. Totalcloud can help save costs by automating the identification of rightsizing opportunities, recommending the right instances to purchase, and taking action by deploying, shutting down, or terminating the resources as per instruction. That’s a lot of birds with one stone.

AWS RDS is also benefited from the response to performance data. For RDS, all the above principles still apply but here, you should pay attention to these specific factors.

Average CPU utilization
Maximum CPU utilization
Minimum available RAM
Average memory being read and written from disk per second

Workload fluctuations
The workload of your environment can fluctuate at different times of the year. High traffic on your servers or increased requirements of memory volumes must all be responded to at the earliest.

There are different ways you can tackle workload fluctuations.

Setting an Auto scaling group will help respond accurately to meet your desired targets and react to changes.
AWS Auto scaling can also be predictive and hence allows itself to be well prepared with sudden spikes.
Automating the rightsizing by scheduling it proactively is a viable option when you have an idea of when certain fluctuations could happen. Totalcloud lets you approach this scenario with scheduling templates.

Setting auto-scaling groups alongside your rightsizing strategies cover you in all the changing demands in machinery. It is unwise to solely rely on your ASG to respond as a lot of fluctuations and demands can be recognized with an analysis of your performance. Preparing beforehand by either modifying the instances on hand or changing their specs is a strategy that incentivizes you to always be aware of your environment.

Rightsizing is an ongoing process
Many companies adhere to forming strict plans that comply with their budget requirements but slack off on keeping up with the developments within the environment or outside.

Rightsizing can’t stop after your first major changes, aside from having a plan ready for when your reservations are expired, keeping up with monitoring activity on a constant basis will open new avenues to make adjustments that can save you money. Constant monitoring also can give you patterns and ideas that aid in predicting your workload.

So starting out with a plan, monitoring the developments, and reworking the plan keeps you ahead of the curve against all possible demands faced during the runtime of your environment.

Top comments (0)