Skip to Content
InfraSpec Logo

InfraSpec

Test your AWS infrastructure code in plain English

Testing infrastructure code shouldn’t require learning complex testing frameworks or writing hundreds of lines of code. InfraSpec lets you write infrastructure tests in plain English using the battle-tested Gherkin syntax.

Traditional infrastructure testing solutions like Terratest require programming knowledge, so writing tests can take as long as writing the infrastructure itself. InfraSpec focuses on intent. Tests read like documentation, are easy to review, and remain understandable over time. This makes collaboration possible not just for engineers, but also for platform, security, and compliance stakeholders.

InfraSpec runs tests against a built-in virtual cloud emulator for fast, deterministic local and CI workflows, or against real AWS APIs for end-to-end validation. Pre-built testing patterns and natural-language specifications ensure tests remain readable, maintainable, and executable from day one.

Features

  • 🗣️ Plain English syntax - Write tests that read like documentation using Gherkin
  • ⚡️ Fast feedback - 10-100x faster than creating real AWS infrastructure
  • 👥 Team-friendly - Non-technical stakeholders can read, review, and contribute
  • 🚀 Zero boilerplate - Works with your existing Terraform configurations out of the box
  • 📚 Rich assertion library - Hundreds of pre-built assertions for AWS resources
  • 🔄 CI/CD ready - Integrates seamlessly with your existing pipelines
  • 💰 Cost effective - Built-in emulator eliminates AWS testing costs
  • 🧪 Flexible testing - Test against real AWS or the Virtual Cloud emulator

Quick start

InfaSpec can be installed using Homebrew (preferred), downloaded as a pre-built binary, or built from source.

Homebrew

  1. Install InfraSpec using Homebrew:
brew tap robmorgan/infraspec brew install infraspec
  1. Initialize a repo containing your infrastructure code:
infraspec init # creates a ./features directory if it doesn't already exist
  1. Create your first infrastructure test:
infraspec new dynamodb.feature
  1. Run the tests
infraspec features/dynamodb.feature

If your using VS Code or Cursor, we recommend installing the Cucumber (Gherkin) Full Support extension for syntax highlighting.

Download prebuilt binaries

Currently, the following binaries are provided:

  • Mac (Apple Silicon)
  • Mac (x64)
  • Linux (x86_64)
  • Linux (aarch64)
  • Windows (win32-x64)
  • Windows (ia32)

You can download them directly from the GitHub releases page.

Building from Source

InfraSpec requires at least Go 1.24.4 to build from source.

To directly install, use:

go install github.com/robmorgan/infraspec@latest

Otherwise:

git clone https://github.com/robmorgan/infraspec.git go build ./cmd/infraspec

Community

stars

InfraSpec was created by Rob Morgan. Follow @_rjm_ on Twitter for future project updates.

Feel free to join the discussions on GitHub!

Last updated on