One minute
CLI Tool to Control AWS Costs via Terraform
Infracost it’s a tool that works with terraform to calculate the costs of the infrastructure setup.
Installation
We need first to install Terraform with we don’t have it already:
brew install terraform
Then we can install Infracost:
brew install infracost
Then register it to get a free API key:
❯ infracost register
Please enter your name and email address to get an API key.
See our FAQ (https://www.infracost.io/docs/faq) for more details.
Name: Albert
Email: albert@example.com
Thank you Albert!
Your API key is: -------------------
Success: Your API key has been saved to /Users/albert/.config/infracost/credentials.yml
You can now run infracost breakdown --path=... and point to your Terraform directory or JSON/plan file.
Usage
To check our current cost based on a Terraform project execute the following taking into account that we have our Terraform project in the current folder:
infracost breakdown --path .