This page is useful if you cannot use one of our existing CI/CD integration. Infracost can be used in any CI/CD system using the following steps. Follow our GitLab CI integration to see examples of how the following steps are used.
Use one of the following options to add the Infracost CLI into your CI/CD:
- Docker images
- CLI executable
We maintain specific CI Docker images:
infracost/infracost:ci-0.10 - Recommended, uses latest patch version of 0.10 to pickup bug fixes and new resources
infracost/infracost:ci-latest - Use latest Infracost image, might break when new minor/major versions are released
curl -O -L https://infracost.io/downloads/v0.10/infracost-linux-amd64.tar.gzto download the latest patch version of 0.10 to pickup bug fixes and new resource costs. You can also use latest, which might break when new minor/major versions are released.
If your infra code is in GitHub, GitLab, Azure Repos, or Bitbucket, run the
commentcommands to generate a cost estimate and post a comment directly.
Otherwise, run the
outputcommands to save the comment markdown (e.g. using
--format github-comment) and post it from your CI/CD system using curl or other command line tools.
You should also set the required environment variables.