Installation

Basic installation guide to get started with LocalStack on your local machine.

This installation guide provides the basic instructions to install LocalStack for the first time, and assumes you are already familiar with the Docker and Python packaging ecosystems.

How to install LocalStack

The first thing when getting started with LocalStack is to choose your preferred way of starting and managing your LocalStack instance.

LocalStack currently provides the following options:

  • LocalStack CLI
    The easiest way to start and manage LocalStack - either on your machine, in a Docker container on your machine, or even on a remote Docker host.

  • LocalStack Cockpit
    Get a desktop experience and work with your local LocalStack instance via the UI.

  • Docker
    Use the docker CLI to manually start the LocalStack Docker container.

  • Docker-Compose
    Use docker-compose to configure and start your LocalStack Docker container.

  • Helm
    Use helm to create a LocalStack deployment in a Kubernetes cluster.

LocalStack CLI

The LocalStack CLI aims to simplify starting and managing LocalStack. It provides convenience features to start LocalStack on your local machine, as a Docker container on your machine, or even on a remote Docker host. In addition you can easily check the status or open a shell in your LocalStack instance if you want to take a deep-dive.

Prerequisites

Please make sure to install the following tools on your machine before moving ahead:

  • python (Python 3.7 up to 3.10 is supported)
  • pip (Python package manager)
  • docker

Installation

You can download the latest version of LocalStack via pip or brew:

python3 -m pip install localstack
brew install localstack

Afterwards you should be able to use the LocalStack CLI in your terminal:

$ localstack --help
Usage: localstack [OPTIONS] COMMAND [ARGS]...

  The LocalStack Command Line Interface (CLI)

Options:
...

Updates

The LocalStack CLI also allows you to easily update the different components of LocalStack. To check the various options available for updating, run:

$ localstack update --help

Usage: localstack update [OPTIONS] COMMAND [ARGS]...

  Update LocalStack components

Options:
  --help  Show this message and exit.

Commands:
  all             Update all LocalStack components
  docker-images   Update container images LocalStack depends on
  localstack-cli  Update LocalStack CLI tools

You can decide to update the CLI itself, the LocalStack Docker images, or all at once:

$ # Update all components
$ localstack update all
$ # Only update the LocalStack docker images
$ localstack update docker-images
$ # Only update the LocalStack CLI
$ localstack update localstack-cli

Starting LocalStack with the LocalStack CLI

By default, LocalStack is started inside a Docker container by running:

$ localstack start

LocalStack Cockpit

See LocalStack Cockpit.

Docker

If you do not want to use the LocalStack CLI, you can also decide to manually start the LocalStack Docker container.

Prerequisites

Please make sure that you have a working docker environment on your machine before moving on. You can check if docker is correctly configured on your machine by executing docker info in your terminal. If it does not report an error (but shows information on your Docker system), you’re good to go.

Starting LocalStack with Docker

You can start the Docker container simply by executing the following docker run command:

$ docker run --rm -it -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack

Docker-Compose

If you want to manually manage your Docker container, it’s usually a good idea to use docker-compose in order to simplify your container configuration.

Prerequisites

Starting LocalStack with Docker-Compose

You can use the docker-compose.yml file from the official LocalStack repository and use this command (currently requires docker-compose version 1.9.0+):

$ docker-compose up

Please note that there’s a few pitfalls when configuring your stack manually via docker-compose (e.g., required container name, Docker network, volume mounts, environment variables, etc.). We recommend using the LocalStack CLI to validate your configuration, which will print warning messages in case it detects any (potential) misconfigurations:

$ localstack config validate
...

Helm

If you want to deploy LocalStack in your Kubernetes cluster, you can use Helm.

Prerequisites

Deploy LocalStack using Helm

You can deploy LocalStack in a Kubernetes cluster by running these commands:

$ helm repo add localstack-repo https://helm.localstack.cloud
$ helm upgrade --install localstack localstack-repo/localstack

The Helm charts are not maintained in the main repository, but in a separate one.

Troubleshooting

  • The LocalStack CLI installation is successful, but I cannot execute localstack on my terminal.

    If you can successfully install LocalStack using pip but you cannot use it in your terminal, you most likely haven’t set up your operating system’s / terminal’s PATH variable (in order to tell them where to find programs installed via pip).

    • If you are using Windows, you can enable the PATH configuration when installing Python, as described in the official docs of Python.
    • If you are using a MacOS or Linux operating system, please make sure that the PATH is correctly set up - either system wide, or in your terminal.

    As a workaround you can call the LocalStack CLI python module directly:

    $ python3 -m localstack.cli.main

  • How should I access the LocalStack logs on my local machine?

    You can now avail logging output and error reporting using LocalStack logs. To access the logs, run the following command:

    $ localstack logs

    AWS requests are now logged uniformly in the INFO log level (set by default or when DEBUG=0). The shape is AWS <service>.<operation> => <http-status> (<error type>). Requests to HTTP endpoints are logged in a similar way:

    2022-09-12T10:39:21.165  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS s3.ListBuckets => 200
    2022-09-12T10:39:41.315  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS s3.CreateBucket => 200
    2022-09-12T10:40:04.662  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS s3.PutObject => 200
    2022-09-12T11:01:55.799  INFO --- [   asgi_gw_0] localstack.request.http    : GET / => 200
    
  • How should I share the LocalStack logs to discover issues?

    You can now share the LocalStack logs with us to help us discover issues. To share the logs, run our diagnostic endpoint:

    $ curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz

    Ensure that the diagnostic endpoint is run after you have tried reproducing the affected task. After running the task, run the diagnostic endpoint and share the archive file with your team members or LocalStack Support.

What’s next?

Now that you have LocalStack up and running, the following resources might be useful for your next steps:


Last modified December 21, 2022: document homebrew installation (#411) (d16c9c93)