top of page
  • Writer's pictureRoger Tai

Infracost & Terraform : Infrastructure Cost Estimation Made Easy

Are you finding that your cloud costs are getting out of hand and hard to manage? Are you spending a significant amount of time trying to identify the sources of your cloud costs and keep them under control?

We as engineers tend to overlook cost implications of using cloud resources, we tend to use cloud resources however we want and not think about the cost impact to the business. Without visibility available to teams, it’s hard to predict and control the ever spiralling cloud costs. It’s crucial to address this challenge by implementing strategies and tools to gain greater visibility into cloud costs, ultimately enabling the organisation to realise the full potential of cloud computing without the bill shock.

FinOps!! Why is it important?

The emergence of FinOps has transformed the approach that organisations take to managing their cloud costs. FinOps is a cultural shift that facilitates collaboration between engineering, finance, and business teams to make data-driven spending decisions, resulting in greater business value realisation. This practice empowers organisations to optimise their cloud costs while still maintaining high levels of innovation and agility.

The following are the key principles of FinOps:

  • Everyone takes ownership for their cloud usage.

  • Reports should be accessible and timely.

  • Decisions are driven by the business value of the cloud.

  • Take advantage of the variable cost model of the cloud.

  • A centralised team drives FinOps.

  • Teams need to collaborate.

These principles are integral to the FinOps approach, and adhering to them can help organisations achieve more efficient, cost-effective, and value-driven cloud management.

Why Cloud Cost Estimation is important?

In my experience, I have seen many organisations overlook the significance of cloud costs optimisations, which often results in cost-cutting measures being implemented in other areas.

Optimising cloud costs is crucial because it enables organisations to maximise their business benefits. By paying only for the necessary resources and avoiding overprovisioning, they can reduce cloud waste and optimise resource allocation through the use of best practices. Consequently, organisations can achieve savings on cloud costs, which can be invested in other departments or projects, allowing them to increase their value proposition and achieve a better return on investment.

What is InfraCost?

In comes InfraCost, it is a tool/platform to empower engineering teams to use cloud infrastructure economically and efficiently. Some key features:

  • Major cloud providers: AWS, GCP & Azure.

  • Supports a wide range of CI/CD systems. e.g. GitHub Actions, Jenkins, Atlantis, etc.

  • Currently it only supports Terraform. With support for Cloudformation & Pulumi coming soon.

  • Enables engineering teams to review the cost impact of the specific changes.

  • Shows all infrastructure changes alongside cost impact.

  • Shows top changes per repo, project, pull requests and users.

  • Weekly summary reports and threshold alerts.


Cloud Infrastructure Cost Estimation with InfraCost - Example

In this example, I set up a dummy terraform file with basic resources and InfraCost’s GitHub Actions workflow (Link to the Github Repository will be provided below).


In the screenshot above, it shows the cost of a brand new infrastructure. It will break down the resources and its associated costs. I have configured Github Actions to run InfraCost on all Pull Requests and display the cost changes as a Pull Request Comment. Because it’s very low cost, I decided that I can afford it for my dummy project.

After the initial Pull Request, I wanted a much bigger instance and changed it from t2.micro to c5.4xlarge. In the screenshot above, it shows the Pull Request with the increased instance size and its associated cost. At this point, I would stop and think whether I want to spend an extra $1,200 to run my dummy project.

What you would not have seen are the Pull Requests that I have created in between. InfraCost has a very cool dashboard that can show changes by date, pull request, repo, project & user.



You can also click on each point on the dashboard which will take you to a more detailed page. The detailed page includes a link to the Github Pull Request, Git Commit SHA, anticipated cost increase or decrease & breakdown of the price changes.

InfraCost Limitations

At the time of writing, it has the following limitations:

  • It does not show any costs for newer instances. e.g. c6*, m6*, mac* etc.

  • It will only calculate the minimum number of instances in an Autoscaling Group.

  • If you are starting from scratch and watch to see your initial cost, you will need Terraform Provider specific as bare minimum.

Conclusion

Infracost provides an innovative solution that empowers individuals, teams, and organisations with cost estimation at the early stages of the supply chain pipeline. By offering cost impact before implementation, a dashboard for analytics, and integration for various CI/CD tooling, Infracost enables users to make informed decisions about their cloud costs and optimise their spending.

At Innablr, our team of cloud experts specialise in Amazon Web Services (AWS), Google Cloud Platform (GCP) and Cloud Native Technologies (Kubernetes & Serverless). We have helped numerous enterprises establish a solid foundation for their cloud environment. Our proven and repeatable process enables our customers to build a sustainable cloud governance process adhering to the FinOps principles, allowing them to optimise their cloud costs while still delivering on business goals.

We pride ourselves on providing vendor-neutral advice that is focused on achieving client outcomes. With a wide view of common challenges, adoption patterns, and growth opportunities, our partnership approach is built on collaboration and knowledge transfer that accelerates skills development for your existing cloud teams.

So, if you’re looking to optimise your cloud spending and build a sustainable cloud governance process, reach out to Innablr. We’d be happy to assist you with our range of services and solutions that are tailored to your specific needs.

Links for references

Comments


bottom of page