Cloud Cost Optimization Techniques: A General Approach

arun karthik
4 min readSep 8, 2022

--

Cost Optimization: The ways to optimize your cloud expense (freepik.com)

Cost optimization is one of the essential topics nowadays in cloud computing. It has become so painful at the end of the month to see the cloud bill hitting the hill tops.

So, in order to optimize this situation and reduce the cloud cost, there are some techniques that need to be followed. Let us see!

  1. Continuous monitoring of resources in Cloud

Resource monitoring is very important topic while coming to cloud cost optimization. We should know what is running in our environment. We can run our cloud environment with number of Virtual Machines (VM’s) which can incur cost to us.

Or we may be running other cloud services (Storage, Networking, Security) parallel to our Virtual Machines by which it can increase our bill cost. So, by continuously monitoring our cloud environment, we can gain an understanding of what is going on inside our cloud and eliminate resources that are no longer needed.

2.Creating automated scripts to optimize the cost

It is a vital need for a DevOps/Cloud engineer to be strong enough to create scripts in daily life. So with this competence, we can be able to create scripts (Python/Bash/Powershell etc.) and automate them to run in a scheduled manner to reduce our cost.

For example, we can create python script as given bellow for stopping EC2 instances in AWS so that we can stop it everyday at specific time period.

Lambda function to stop all EC2 instances across AWS regions

The above image has a lambda function which can stop all the EC2 instances across regions. With the help of this, we can create a lambda with a trigger CloudWatch event to run this lambda daily at a specific time to stop all the EC2 instances so that we can save our AWS cost.

Also we should delete unwanted instances which are running. We create instances that are running for testing some code, application, etc. We should terminate them if we’re not using. They can cause unnecessary costs.

3. Setting alarms to resource usage

Alarms are used to monitor the charges. Enabling alarms can help us sending different notifications and warning regarding cloud usage. The alarm will trigger when the billing exceeds the threshold.

a. AWS Alarm

b. Azure Billing Notifications

c. GCP Budget Alerts

4. Identify Idle Resources

To optimize cloud costs, the next step is to identify idle resources. An idle resource can have a utilization level of up to 6%. When we receive a bill for 100% of that resource, it really is a waste of time for us. So, to attain an optimized cloud cost, you need to identify such resources and reduce them.

Cloud computing has autoscaling, load balancing, and on-demand solutions that allow you to scale up the computing power at any time. You have to make use of this.

5. Choose right size for computing

Picking the right size is crucial for efficient cloud computing.

There are various tools to do this:

6. Multi-cloud vs. Single Cloud

It may seems to wise decision to opt for multi cloud in order to avoid vendor lock-in. While this is a vert good strategy to increase the availability and uptime, this can cost us losing potential volume discounts by a single cloud vendor. On top, there are administrative hassles of switching between multiple platforms, paying for network traffic between cloud providers, and staffing multiple cloud experts.

7. Choosing Spot Instances

Spot Instances can help you save money on cloud expenses. They are available on auction and, if the price is right fit for you, they can be opted for instant usage. But, chances to buy them can quick. They are best suited for specific cases such as batch jobs and jobs that can be terminated immediately.

8. Invest in RI (Reserved Instances)

Companies dealing with cloud solutions for the long run should invest in RI’s. These can give us good discounts based on upfront payment and time.

For more details on RIs:

9. Utilizing Heat Maps

Make use of Heat maps are important for cloud cost optimization. It is a visual tool showing peaks and valleys in computing. This information can be useful in establishing start and stop times to reduce costs. While cloud engineers can shut down servers, a better option is to leverage automation to schedule instances to start and stop, thereby optimizing costs.

For example, AWS Heat Maps

Conclusion

Until now, we have seen various approaches and techniques used to reduce the cloud billing cost. Please contact me at https://www.linkedin.com/in/arunsky/ for more information.

--

--

arun karthik
arun karthik

Responses (1)