Skip to main content

WireMock Extension for LocalStack

Project description

WireMock on LocalStack

This repo contains a LocalStack Extension that facilitates developing WireMock-based applications locally.

The extension supports two modes:

  • OSS WireMock: Uses the open-source wiremock/wiremock image (default)
  • WireMock Runner: Uses wiremock/wiremock-runner with WireMock Cloud integration (requires API token)

Prerequisites

  • Docker
  • LocalStack Pro (free trial available)
  • localstack CLI
  • make
  • WireMock CLI (for WireMock Runner mode)

Install from GitHub repository

This extension can be installed directly from this Github repo via:

localstack extensions install "git+https://github.com/localstack/localstack-extensions.git#egg=localstack-wiremock&subdirectory=wiremock"

Install local development version

To install the extension into LocalStack in developer mode, you will need Python 3.11, and create a virtual environment in the extensions project.

In the newly generated project, simply run

make install

Then, to enable the extension for LocalStack, run

localstack extensions dev enable .

You can then start LocalStack with EXTENSION_DEV_MODE=1 to load all enabled extensions:

EXTENSION_DEV_MODE=1 localstack start

Usage

OSS WireMock Mode (Default)

Start LocalStack without any special configuration:

localstack start

The WireMock server will be available at http://wiremock.localhost.localstack.cloud:4566.

You can import stubs using the WireMock Admin API (assuming a stubs.json exists in the local working directory):

curl -X POST -H "Content-Type: application/json" \
  --data-binary "@stubs.json" \
  "http://wiremock.localhost.localstack.cloud:4566/__admin/mappings/import"

WireMock Runner Mode (Cloud Integration)

To use WireMock Runner with WireMock Cloud, you need:

  1. A WireMock Cloud API token
  2. A .wiremock directory with your mock API configuration

Step 1: Get your WireMock Cloud API Token

  1. Sign up at WireMock Cloud
  2. Go to Settings → API Tokens
  3. Create a new token

Step 2: Create your Mock API configuration

First, create a Mock API in WireMock Cloud, then pull the configuration locally:

# Install WireMock CLI if not already installed
npm install -g @wiremock/cli

# Login with your API token
wiremock login

# Pull your Mock API configuration
# Find your Mock API ID from the WireMock Cloud URL (e.g., https://app.wiremock.cloud/mock-apis/zwg1l/...)
wiremock pull mock-api <mock-api-id>

This creates a .wiremock directory with your wiremock.yaml configuration.

Step 3: Start LocalStack with WireMock Runner

LOCALSTACK_WIREMOCK_API_TOKEN="your-api-token" \
LOCALSTACK_WIREMOCK_CONFIG_DIR="/path/to/your/project" \
localstack start

Environment Variables:

  • WIREMOCK_API_TOKEN: Your WireMock Cloud API token (required for runner mode)
  • WIREMOCK_CONFIG_DIR: Path to the directory containing your .wiremock folder (required for runner mode)

Note: When using the LocalStack CLI, prefix environment variables with LOCALSTACK_ to forward them to the container.

Sample Application

See the sample-app-runner/ directory for a complete example using Terraform that demonstrates:

  • Creating an API Gateway
  • Lambda function that calls WireMock stubs
  • Integration testing with mocked external APIs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localstack_wiremock-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

localstack_wiremock-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file localstack_wiremock-0.1.0.tar.gz.

File metadata

  • Download URL: localstack_wiremock-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for localstack_wiremock-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e1cbe61b9357b230e948d9c1a49678c504e701aff8de11d0866ca9cf7d4713f
MD5 93d8a4bf7ac8d5d6b43c383142aa53d2
BLAKE2b-256 77f77d482a99ce79fee10fae7e4493d81d91fa0c98df66c0a9d673d99d4a27e3

See more details on using hashes here.

File details

Details for the file localstack_wiremock-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for localstack_wiremock-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5418220c149490e7c3bd913f0b6acb1d2dfaf9ef87460d495eea5d7eb68b32c1
MD5 3d16c9ed97b05f346a8ea1e056a93683
BLAKE2b-256 d24b81e80247051015439e4e834157ad06fcf11086c8a7159ce78b2eec60174b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page