Tool - Infracost for Terraform and Cloud Pricing
Today, I want to introduce you to a tool you’ll see a lot of here on Cost Optimized Cloud aimed at providing clarity in infrastructure costs. Say hello to Infracost!
Occasionally, you come across a tool that causes you to pause and seriously wonder how you went so long without it.
Infracost is one of those tools.
The best part about this tool is that it addresses one of our core tenets here at Cost Optimized Cloud—getting engineers visibility and involvement with the problem of cost optimization.
Now that I’ve found it, I’m using it for everything. It’s easy to install and get working, and the immediate application is satisfying to say the least.
So, what is Infracost?
Infracost titles itself as “the Cloud’s Checkout Screen,” and I think that’s a correct take.
What it allows you to do is easily understand the cost of infrastructure-as-code before you deploy it. It does this using an API that can gather up-to-date pricing for cloud infrastructure costs. As a user, you can see these costs either in the Terraform file itself via a VS Code extension or by running some simple CLI commands.
These prices include almost any resource you can create on Terraform. Compute, Storage, Databases...even Networking.
You have control to adjust parameters that might increase or decrease spend based on the resource (see above). Say you want to adjust the amount of data being processed on a Transit Gateway attachment—you can change it, play around with different figures, and see how that impacts cost without ever having to deploy it. How nice is that? You can read about even more of the use cases here.
Infracost works with the Big 3 CSPs, has widespread support for common CI/CD options, and is expanding past Terraform to eventually include CloudFormation (yay) and Pulumi.
Price visibility in the public cloud is a challenge, and being able to do it quickly is an even bigger one. Infracost makes that process simple by getting you pricing without having to build and spend money.
Please go and check this tool out. Whether you’re making labs or deploying IaC to prod—I think it’s well worth your time to at least check it out and see if it’s a value add to your existing processes.