Skip to content
Get Started for Free

CI Integration

LocalStack helps you run integration tests in CI against emulated AWS infrastructure. Your pipeline starts LocalStack inside the CI job, deploys or prepares the resources your application needs, runs tests against the local endpoint, and then discards the environment when the job ends.

A typical CI job with LocalStack follows this flow:

  1. Check out your application code.
  2. Start LocalStack in the CI runner.
  3. Configure a CI Auth Token through the CI provider’s secret manager.
  4. Deploy test infrastructure with tools such as awslocal, tflocal, cdklocal, or your application’s test harness.
  5. Run integration tests against the LocalStack endpoint.
  6. Collect logs, test reports, and artifacts from the job.

This gives every pipeline run a fresh AWS-compatible environment without creating cloud resources in an AWS account.

CI runs are usually more constrained than local development:

  • Use a dedicated CI Auth Token instead of a personal Developer Token.
  • Store LOCALSTACK_AUTH_TOKEN as a protected CI secret.
  • Start LocalStack non-interactively as part of the job.
  • Treat the LocalStack container as ephemeral unless your workflow explicitly saves state.
  • Export logs and test reports before the runner shuts down.

Docker and Docker Compose are still common ways to run containers inside CI runners, but they are not CI tools by themselves. For container startup details, see the Installation guide. For provider-specific CI setup, use the integration guides below.

Start with the CI system you use. These snippets show the basic LocalStack startup shape for each provider; the linked guides include authentication, configuration, logs, state management, and provider-specific caveats.

- name: Start LocalStack
uses: LocalStack/setup-localstack@main
with:
image-tag: 'latest'
install-awslocal: 'true'
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}

See the GitHub Actions guide for the full setup.

You can also start from the CI integrations overview if you want a broader explanation of the CI workflow.

CI environments should use a CI Auth Token. Create one from the Auth Tokens page, then store it as LOCALSTACK_AUTH_TOKEN in your CI provider’s secret manager.

Do not commit tokens to your repository or write them directly into workflow files. For more details on token types and rotation, see the Auth Token guide.

Most CI jobs should start with a clean LocalStack instance. A fresh instance makes test runs reproducible and avoids hidden dependencies between jobs.

If your pipeline needs state across jobs or workflow stages, use one of the state management options documented outside this getting started page:

After choosing your CI provider, continue to AI & Agent Workflows to learn how AI coding assistants can help generate, deploy, and test LocalStack-backed AWS applications.

Was this page helpful?