Shell C# Ruby CSS JavaScript HTML Java Amazon Web Services Python
Need help with localstack?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.


💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline!

27.4K Stars 2.1K Forks Other 1.6K Commits 270 Opened issues

Services available

Need anything else?

Build Status Backers on Open Collective Sponsors on Open Collective Coverage Status Gitter PyPI Version PyPI License Code Climate Twitter

LocalStack - A fully functional local AWS cloud stack


LocalStack provides an easy-to-use test/mocking framework for developing Cloud applications.

Currently, the focus is primarily on supporting the AWS cloud stack.


  • 2020-09-15: A major (breaking) change has been merged in PR #2905 - starting with releases after
    , all services are now exposed via the edge service (port 4566) only! Please update your client configurations to use this new endpoint.
  • 2019-10-09: LocalStack Pro is out! We're incredibly excited to announce the launch of LocalStack Pro - the enterprise version of LocalStack with additional APIs and advanced features. Check out the free trial at
  • 2018-01-10: Help wanted! Please fill out this survey to support a research study on the usage of Serverless and Function-as-a-Service (FaaS) services, conducted at the Chalmers University of Technology. The survey only takes 5-10 minutes of your time. Many thanks for your participation!!
    • The result from this study can be found here
  • 2017-08-27: We need your support! LocalStack is growing fast, we now have thousands of developers using the platform regularly. Last month we have recorded a staggering 100k test runs, with 25k+ DynamoDB tables, 20k+ SQS queues, 15k+ Kinesis streams, 13k+ S3 buckets, and 10k+ Lambda functions created locally - for 0$ costs (more details to be published soon). Bug and feature requests are pouring in, and we now need some support from you to keep the open-source version actively maintained. Please check out Open Collective and become a backer or supporter of the project today! Thanks, everybody for contributing. ♥
  • 2017-07-20: Please note: Starting with version
    , the Docker image will be pushed and kept up to date under the new name
    . (This means that you may have to update your CI configurations.) Please refer to the updated End-User License Agreement (EULA) for the new versions. The old Docker image (
    ) is still available but will not be maintained any longer.


LocalStack spins up the following core Cloud APIs on your local machine.

Note: Starting with version

, all APIs are exposed via a single edge service, which is accessible on http://localhost:4566 by default (customizable via
, see further below).
  • ACM
  • API Gateway
  • CloudFormation
  • CloudWatch
  • CloudWatch Logs
  • DynamoDB
  • DynamoDB Streams
  • EC2
  • Elasticsearch Service
  • EventBridge (CloudWatch Events)
  • Firehose
  • IAM
  • Kinesis
  • KMS
  • Lambda
  • Redshift
  • Route53
  • S3
  • SecretsManager
  • SES
  • SNS
  • SQS
  • SSM
  • StepFunctions
  • STS

In addition to the above, the Pro version of LocalStack supports additional APIs and advanced features, including: * Amplify * API Gateway V2 (WebSockets support) * AppSync * Athena * CloudFront * CloudTrail * Cognito * ECS/ECR/EKS * ElastiCache * EMR * Glacier / S3 Select * IoT * Kinesis Data Analytics * Lambda Layers * Managed Streaming for Kafka (MSK) * MediaStore * QLDB * RDS * Transfer * XRay * Interactive UIs to manage resources * Test report dashboards * ...and much, much more to come!

Why LocalStack?

LocalStack builds on existing best-of-breed mocking/testing tools, notably kinesalite/dynalite and moto, ElasticMQ, and others. While these tools are awesome (!), they lack functionality for certain use cases. LocalStack combines the tools, makes them interoperable, and adds important missing functionality on top of them:

  • Error injection: LocalStack allows to inject errors frequently occurring in real Cloud environments, for instance
    which is thrown by Kinesis or DynamoDB if the amount of read/write throughput is exceeded.
  • Isolated processes: Services in LocalStack can be run in separate processes. In moto, components are often hard-wired in memory (e.g., when forwarding a message on an SNS topic to an SQS queue, the queue endpoint is looked up in a local hash map). In contrast, LocalStack services live in isolation (separate processes/threads communicating via HTTP), which fosters true decoupling and more closely resembles the real cloud environment.
  • Pluggable services: All services in LocalStack are easily pluggable (and replaceable), due to the fact that we are using isolated processes for each service. This allows us to keep the framework up-to-date and select best-of-breed mocks for each individual service.


  • python
    (both Python 2.x and 3.x supported)
  • pip
    (python package manager)
  • Docker


The easiest way to install LocalStack is via

pip install localstack

Note: Please do not use

or the
user - LocalStack should be installed and started entirely under a local non-root user. If you have problems with permissions in MacOS X Sierra, install with
pip install --user localstack

Running in Docker

By default, LocalStack gets started inside a Docker container using this command:

localstack start

(Note that on MacOS you may have to run

TMPDIR=/private$TMPDIR localstack start --docker
contains a symbolic link that cannot be mounted by Docker.)

Note: From 2020-07-11 onwards, the default image

in Docker Hub refers to the "light version", which has some large dependency files like Elasticsearch removed (and lazily downloads them, if required). (Note that the
image alias may get removed in the future). In case you need the full set of dependencies, the
image can be used instead. Please also refer to the
configuration below.

(Note: Although it is strongly recommended to use Docker, the infrastructure can also be spun up directly on the host machine using the

startup flag. Note that this will require additional dependencies, and is not supported on some operating systems, including Windows.)


You can also use the

file from the repository and use this command (currently requires
version 1.9.0+):
docker-compose up

(Note that on MacOS you may have to run

TMPDIR=/private$TMPDIR docker-compose up
contains a symbolic link that cannot be mounted by Docker.)

To facilitate interoperability, configuration variables can be prefixed with

in docker. For instance, setting
is equivalent to


You can pass the following environment variables to LocalStack:

    : Port number for the edge service, the main entry point for all API invocations (default:
    : Comma-separated list of service names (APIs) to start up. Service names basically correspond to the service names of the AWS CLI (
    , etc), although LocalStack only supports a subset of them. Example value:
    to start Kinesis, Lambda, and SQS. In addition, the following shorthand values can be specified to run a predefined ensemble of services:
    • serverless
      : run services often used for Serverless apps (
    : AWS region to use when talking to the API (default:
    : Name of the host to expose the services internally (default:
    ). Use this to customize the framework-internal communication, e.g., if services are started in different containers using docker-compose.
    : Name of the host to expose the services externally (default:
    ). This host is used, e.g., when returning queue URLs from the SQS service to the client.
    : Port number to expose a specific service externally (defaults to service ports above).
    , for example, is used when returning queue URLs from the SQS service to the client.
    : Specific name and tag of LocalStack Docker image to use, e.g.,
    : Whether to use the light-weight Docker image (default:
    ). Overwritten by
    : Decimal value between 0.0 (default) and 1.0 to randomly inject
    errors into Kinesis API responses.
    : Integer value (default:
    ) or
    (to disable), causing the Kinesis API to start throwing exceptions to mimick the default shard limit.
    : Integer value (default:
    ) or
    (to disable), causing the Kinesis API to delay returning a response in order to mimick latency from a live AWS call.
    : Decimal value between 0.0 (default) and 1.0 to randomly inject
    errors into DynamoDB API responses.
    : Sets the JAVA EE maximum memory size for dynamodb values are (integer)m for MB, (integer)G for GB default(256m), full table scans require more memory
    : URL to use as the Lambda service endpoint in Step Functions. By default this is the LocalStack Lambda endpoint. Use
    to select the original AWS Lambda endpoint.
    : Method to use for executing Lambda functions. Possible values are:
    • local
      : run Lambda functions in a temporary directory on the local machine
    • docker
      : run each function invocation in a separate Docker container
    • docker-reuse
      : create one Docker container per function and reuse it across invocations


, if LocalStack itself is started inside Docker, then the
command needs to be available inside the container (usually requires to run the container in privileged mode). Default is
, fallback to
if Docker is not available. *
determines whether Lambda code is copied or mounted into containers. Possible values are: -
(default): your Lambda function definitions will be passed to the container by copying the zip file (potentially slower). It allows for remote execution, where the host and the client are not on the same machine. -
: your Lambda function definitions will be passed to the container by mounting a volume (potentially faster). This requires to have the Docker client and the Docker host on the same machine. *
: Optional Docker network for the container running your lambda function. *
: Optional DNS server for the container running your lambda function. *
Use an alternative docker registry to pull lambda execution containers (default:
). *
: Whether to remove containers after Lambdas finished executing (default:
). *
: Local directory for saving persistent data (currently only supported for these services: Kinesis, DynamoDB, Elasticsearch, S3, Secretsmanager, SSM, SQS, SNS). Set it to
to enable persistence (
is mounted into the Docker container), leave blank to disable persistence (default). *
: Port for the Web user interface / dashboard (default:
). Note that the Web UI is now deprecated, and requires to use the
Docker image. *
: Custom endpoint URL to use for a specific service, where
 is the uppercase
  service name (currently works for: 
). This allows to easily integrate third-party services into LocalStack. *
: when running with Docker, disables the
flags. Useful when running headless. *
: Allows to pass custom flags (e.g., volume mounts) to "docker run" when running LocalStack in Docker. *
: Shell command used to run Docker containers, e.g., set to
"sudo docker"
to run as sudo (default:
). *
: Whether to skip downloading additional infrastructure components (e.g., specific Elasticsearch versions). *
: Flag to control whether the Web UI should be started in Docker (values:
; default:
). *
: Fallback URL to use when a non-existing Lambda is invoked. Either records invocations in DynamoDB (value
) or forwards invocations as a POST request (value
). *
: Comma-separated list of header names to be be added to
CORS header *
: Comma-separated list of header names to be be added to
CORS header *
: Allow passing custom JVM options (e.g.,
) to Java Lambdas executed in Docker. Use
placeholder to configure the debug port (e.g.,
). *
: Specify the main docker container name (default:
). *
: Specify the path to the initializing files with extensions .sh that are found default in

The following environment configurations are deprecated: *

: Whether to use
URLs with SSL encryption (default:
). Deprecated as of version 0.11.3 - each service endpoint now supports multiplexing HTTP/HTTPS traffic over the same port.

Additionally, the following read-only environment variables are available:

    : Name of the host where LocalStack services are available. Use this hostname as endpoint (e.g.,
    ) in order to access the services from within your Lambda functions (e.g., to store an item to DynamoDB or S3 from a Lambda).

An example passing the above environment variables to LocalStack to start Kinesis, Lambda, Dynamodb and SQS:

SERVICES=kinesis,lambda,sqs,dynamodb localstack start

Dynamically updating configuration at runtime

Each of the service APIs listed above defines a backdoor API under the path

which allows to dynamically update configuration variables defined in

For example, to dynamically set

at runtime, use the following command:
curl -v -d '{"variable":"KINESIS_ERROR_PROBABILITY","value":1}' 'http://localhost:4566/?_config_'

Service health checks

The service

check endpoint on the edge port (
by default) provides basic information about the status of each service (e.g.,
). By default, the endpoint returns cached values that are determined during startup - the status values can be refreshed by adding the
query parameter:

Initializing a fresh instance

When a container is started for the first time, it will execute files with extensions .sh that are found in

or an alternate path defined in
. Files will be executed in alphabetical order. You can easily create aws resources on localstack using
) cli tool in the initialization scripts.

Using custom SSL certificates

To use your own SSL certificate instead of the randomly generated certificate, you can place a file

into the LocalStack temporary directory (
, or
by default). The file
must contain the key file, as well as the certificate file content:

Using custom SSL certificates with docker-compose

Typically with docker-compose you can add into docker-compose.yml this volume to the LocalStack services :

    - "${PWD}/ls_tmp:/tmp/localstack"
    - "/var/run/docker.sock:/var/run/docker.sock"

The local directory

must contains the three files (server.test.pem, server.test.pem.crt, server.test.pem.key)

Accessing the infrastructure via CLI or code

You can point your

CLI to use the local infrastructure, for example:
aws --endpoint-url=http://localhost:4566 kinesis list-streams
    "StreamNames": []

Use the below command to install

aws CLI
, if not installed already.
pip install awscli

Setting up local region and credentials to run LocalStack

aws requires the region and the credentials to be set in order to run the aws commands. Create the default configuration & the credentials. Below key will ask for the Access key id, secret Access Key, region & output format.

aws configure --profile default

Config & credential file will be created under ~/.aws folder

NOTE: Please use

as Access key id and secret Access Key to make S3 presign url work. We have added presign url signature verification algorithm to validate the presign url and its expiration. You can configure credentials into the system environment using
command in the linux/Mac system. You also can add credentials in
file directly.
export AWS_ACCESS_KEY_ID=test

NEW: Check out awslocal, a thin CLI wrapper that runs commands directly against LocalStack (no need to specify

anymore). Install it via
pip install awscli-local
, and then use it as follows:
awslocal kinesis list-streams
    "StreamNames": []

UPDATE: Use the environment variable

to determine the target host inside your Lambda function. See Configurations section for more details.

Using the official AWS CLI version 2 Docker image with Localstack Docker container

By default the container running amazon/aws-cli is isolated from
on the host machine, that means that aws-cli cannot reach localstack through your shell.

To ensure that the two docker containers can communicate create a network on the docker engine:

$ ▶ docker network create localstack

Then modify the

specifying the network to use:
      name: "localstack"

Run AWS Cli v2 docker container using this network (example):

$ ▶ docker run --network localstack --rm -it amazon/aws-cli --endpoint-url=http://localstack:4566 lambda list-functions
    "Functions": []

If you use AWS CLI v2 from a docker container often, create an alias:

$ ▶ alias laws='docker run --network localstack --rm -it amazon/aws-cli --endpoint-url=http://localstack:4566'

So you can type:

$ ▶ laws lambda list-functions
    "Functions": []

Client Libraries

  • Python:
    • alternatively, you can also use
      and use the
      parameter when creating a connection
  • (more coming soon...)

Invoking API Gateway

While API Gateway endpoints on AWS use a custom DNS name to identify the API ID (e.g.,
), LocalStack uses the special URL path indicator
to indicate the execution of a REST API method.

The URL pattern for API Gateway executions is

. The example URL above would map to the following
$ curl http://localhost:4566/restapis/nmafetnwf6/prod/_user_request_/my/path

Integration with nosetests

If you want to use LocalStack in your integration tests (e.g., nosetests), simply fire up the infrastructure in your test setup method and then clean up everything in your teardown method:

from import infra

def setup(): infra.start_infra(asynchronous=True)

def teardown(): infra.stop_infra()

def my_app_test(): # here goes your test logic

See the example test file

for more details.

Integration with Serverless

You can use the

plugin to easily run Serverless applications on LocalStack. For more information, please check out the plugin repository here:

Integration with Terraform

You can use Terraform to provision your resources locally. Please refer to the Terraform AWS Provider docs here on how to configure the API endpoints on


Using local code with Lambda

In order to mount a local folder, ensure that

is set to
then set the S3 bucket name to
and the S3 key to your local path:
awslocal lambda create-function --function-name myLambda \
    --code S3Bucket="__local__",S3Key="/my/local/lambda/folder" \
    --handler index.myHandler \
    --runtime nodejs8.10 \
    --role whatever

Integration with Java/JUnit

In order to use LocalStack with Java, the project ships with a simple JUnit runner, see sample below.

import cloud.localstack.LocalstackTestRunner;
import cloud.localstack.TestUtils;
import cloud.localstack.docker.annotation.LocalstackDockerProperties;

@RunWith(LocalstackTestRunner.class) @LocalstackDockerProperties(services = { "s3", "sqs", "kinesis:77077" }) public class MyCloudAppTest {

@Test public void testLocalS3API() { AmazonS3 s3 = TestUtils.getClientS3() List buckets = s3.listBuckets(); ... } }

For more details and a complete list of configuration parameters, please refer to the LocalStack Java Utils repository.


  • If you're using AWS Java libraries with Kinesis, please, refer to CBOR protocol issues with the Java SDK guide how to disable CBOR protocol which is not supported by kinesalite.

  • Accessing local S3: To avoid domain name resolution issues, you need to enable path style access on your S3 SDK client. Most AWS SDKs provide a config to achieve that, e.g., for Java:

    // There is also an option to do this if you're using any of the client builder classes:
    AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard();
  • Mounting the temp. directory: Note that on MacOS you may have to run

    TMPDIR=/private$TMPDIR docker-compose up
    contains a symbolic link that cannot be mounted by Docker. (See details here:
  • If you run into file permission issues on

    pip install
    under Mac OS (e.g.,
    Permission denied: '/Library/Python/2.7/site-packages/'
    ), then you may have to re-install
    via Homebrew (see this discussion thread). Alternatively, try installing with the
    pip install --user localstack
  • If you are deploying within OpenShift, please be aware: the pod must run as

    , and the user must have capabilities added to the running pod, in order to allow Elasticsearch to be run as the non-root
  • If you are experiencing slow performance with Lambdas in Mac OS, you could either (1) try mounting local code directly into the Lambda container, or (2) disable mounting the temporary directory into the LocalStack container in docker-compose. (See also

  • The environment variable

    is rewritten by LocalStack. (Internal requests will go straight via localhost, bypassing any proxy configuration).
  • For troubleshooting LocalStack start issues, you can check debug logs by running

    DEBUG=1 localstack start
  • In case you get errors related to node/nodejs, you may find (this issue comment: helpful.

  • If you are using AWS Java libraries and need to disable SSL certificate checking, add

    to the java invocation.


Requirements for developing or starting locally

To develop new features, or to start the stack locally (outside of Docker), the following additional tools are required:

  • make
  • npm
    (node.js package manager)
  • java
    (Java 8 runtime environment and compiler)
  • mvn
    (Maven, the build system for Java)
  • moto
    (for testing)
  • docker-compose
    (for running the localstack using docker-compose)
  • mock
    (for unit testing)
  • pytest
    (for unit testing)
  • pytest-cov
    (to check the unit-testing coverage)

Development Environment

If you pull the repo in order to extend/modify LocalStack, run this command to install all the dependencies:

make install

This will install the required pip dependencies in a local Python virtualenv directory

(your global python packages will remain untouched), as well as some node modules in
. Depending on your system, some pip/npm modules may require additional native libs installed.

The Makefile contains a target to conveniently run the local infrastructure for development:

make infra

Check out the developer guide which contains a few instructions on how to get started with developing (and debugging) features for LocalStack.


The project contains a set of unit and integration tests that can be kicked off via a make target:

make test

To check the Code Coverage

Once the new feature / bug fix is done, run the unit testing and check for the coverage.

# To run the particular test file (sample)
pytest --cov=localstack tests/unit/

To check the coverage in the console

coverage report

To check the coverage as html (output will be redirected to the html folder)

coverage html

Web Dashboard (deprecated)

The projects also comes with a simple Web dashboard that allows to view the deployed AWS components and the relationship between them.

localstack web

Please note that the Web UI requires using the extended version of the Docker image (


Note: The Web dashboard is not actively maintained anymore and may get removed in an upcoming release.

Other UI Clients

Change Log

Please refer to
to see the complete list of changes for each release.


We welcome feedback, bug reports, and pull requests!

For pull requests, please stick to the following guidelines:

  • Add tests for any new features and bug fixes. Ideally, each PR should increase the test coverage.
  • Follow the existing code style (e.g., indents). A PEP8 code linting target is included in the Makefile.
  • Put a reasonable amount of comments into the code.
  • Fork localstack on your github user account, do your changes there and then create a PR against main localstack repository.
  • Separate unrelated changes into multiple pull requests.
  • 1 commit per PR: Please squash/rebase multiple commits into one single commit (to keep the history clean).

Please note that by contributing any code or documentation to this repository (by raising pull requests, or otherwise) you explicitly agree to the Contributor License Agreement.


This project exists thanks to all the people who contribute.


Thank you to all our backers! 🙏 [Become a backer]


Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Stargazers over time

Stargazers over time


Copyright (c) 2017-2020 LocalStack maintainers and contributors.

Copyright (c) 2016 Atlassian and others.

This version of LocalStack is released under the Apache License, Version 2.0 (see LICENSE.txt). By downloading and using this software you agree to the End-User License Agreement (EULA).

We build on a number of third-party software tools, including the following:

Third-Party software

Python/pip modules:
airspeed BSD License
amazonkclpy Amazon Software License
boto3 Apache License 2.0
coverage Apache License 2.0
docopt MIT License
elasticsearch Apache License 2.0
flask BSD License
flaskswagger MIT License
jsonpath-rw Apache License 2.0
moto Apache License 2.0
requests Apache License 2.0
subprocess32 PSF License
Node.js/npm modules:
kinesalite MIT License
Other tools:
Elasticsearch Apache License 2.0
local-kms MIT License

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.