8 way to Clod AWS

8 Tips to Optimize and Save Cloud costs in AWS

Written by Abhijit Pisharody

| Aug 18, 2022

4 MIN READ

There is a significant rise in cloud adoption by organizations seeking advantages such as easy scaling, standardization, cost savings, accessibility, as well as services offered by the cloud. However, more often than not, organizations find themselves not benefitting from the cost aspect, especially when they are just beginning their cloud journey. In this article, we take a look at ways to set up your AWS infrastructure in a way that your cloud costs are optimized, and that you are not a victim of cloud waste.

A bulk of the costs with respect to AWS instances are associated with computing or storage, in all the various forms that AWS provides. Therefore, it would come as no surprise that most of the cost optimization strategies will revolve around optimizing them.

1) Lift and Shift vs Cloud-Native applications

A very popular approach when it comes to moving from on-premise to the cloud is Lift and Shift, where you replicate your on-premises environment on AWS using EC2 instances and make no changes at an application level.

This approach, while simple, comes with the risk of being woefully unoptimized and expensive in the long run. Considering the complexity, criticality, and compatibility of your application functions with AWS, you should make your applications cloud-native, which will be advised especially if you wish to deploy on the cloud for the long run.

2) Reassess your EC2 instances

A bulk of the computing on AWS is performed with EC2 instances, be it as spot, on-demand, or reserved. Reassess EC2 instances running in your environment and ask yourself the following questions to take better decisions:

  • Are these instances sized correctly? What is the average load utilization of these resources? Can I go for a cheaper instance type?
  • Is there a pattern to utilization within my environment, peaking at a specific time and troughing at a certain time period? Since infrastructure provisioning is quick and cheap, can I make do with lower-powered instances, spinning up more as required?
  • Do I need my instances to be running 24/7? If not, can I use schedulers to manually stop and start instances as required?
  • Do I care about when exactly my instances run? If not, can I use spot instances to lower costs, at the risk that my application might be randomly interrupted?

3) Reserve EC2 instances

If you see high utilization throughout your cluster on average, you can consider reserving EC2 instances for a significant cost reduction. This action along with reserving other services such as Redshift, ElastiCache, and Elasticsearch can lower your costs by up to 40% if done on a yearly basis.

4) Identify unused EC2 instances and orphaned resources

Periodically monitor IOPS to identify instances with little to no usage. In development environments, consider automating this process to automatically terminate instances wherein the IOPS per week is less than a particular threshold.

Very often, orphan resources are created when EC2 instances are terminated but their volumes remain active. This needs to be monitored and reduced.

5) Consider using AWS Fargate

AWS Fargate is a serverless, pay-as-you-go compute engine that lets you focus on building applications without managing servers. If you have small workloads with unexpected bursts, fargate could be the perfect solution as it will handle scaling up and down as per the requests.

augBlogImg

AWS Fargate

Fargate also removes the overhead of managing your infrastructure and instead pushes it onto AWS. This saves you considerable operations and time-based costs while managing your AWS infrastructure. For example, when the meltdown vulnerability was discovered, organizations managing their own instances had to manually patch their operating systems while those using Fargate automatically got a quick patch behind the scenes by AWS engineers.

If your workload is large and has consistently high resource utilization, this option might be detrimental. Utilizing reserved instances is a better idea in this case.

6) Enforce IaC within your development processes

Enforce the usage of IaC tools such as Terraform or CloudFormation along with configuring tools such as Ansible for provisioning your AWS infrastructure and setting up your applications. This allows you to destroy and recreate your architecture as per the need. Tear down the architecture at the end of work hours and rebuild it before work hours begin.

This approach is better than stopping the instances altogether as even stopped instances cost money for the storage attached to it. Use snapshots to dump and retrieve data between these teardowns and rebuilds. Automate the snapshot cleanup to avoid snapshot bloats.

Creating and destroying resources with this approach also eliminates any risk of orphaned resources, as all associated resources are destroyed via IaC.

7) Enforce tagging and lifecycle policy management for resources

Not setting the correct Lifecycle policies is a sure-shot way to have resource sprawl overwhelm your system, inflating cloud costs significantly. Ensure that S3 lifecycle policies are set to avoid retention of unnecessary buckets eating up your cloud costs.

Tagging allows us to properly manage resource sprawl and isolate resources that cost higher than expected. Any untagged instance must be treated as a risk as they severely limit the visibility of their spending patterns.

8) Choose correct tiering while using S3

Use intelligent tiering to automatically detect the tiering required in order to save costs. If you are sure about the access frequency for your data, choose the correct tiering as per this list to have significant cost reductions.

Some optimizations that are not centered around storage and computing are:

  1. To detect LoadBalancers with low RequestCounts and delete them
  2. To release any unassigned elastic IP
  3. To use CloudFront to distribute content if your data transfer costs from EC2 to public internet are high
  4. While using services such as DynamoDB, ensure you turn on auto-scaling

We hope this article has helped you to get a better understanding of how you can optimize your cloud costs in AWS. If you are interested then, you might want to check out this blog on how the Ashnik team utilized a CloudOps tool in solving critical business challenges that are faced by your enterprise.”

If you are looking to get subscriptions, support, or services for open source technologies, talk to Ashnik – a leading open source solutions company in Southeast Asia and India, offering a full-fledged open source technology marketplace, support, solutions, and services for consulting, managed, technical, training and more. Get in touch today!


Go to Top