---
name: localstack
description: Manage the LocalStack emulator lifecycle with the lstk CLI. Use when users need to start, stop, restart, reset, or check status of LocalStack, configure LocalStack environment variables, or troubleshoot LocalStack container issues.
title: localstack
canonical_url: https://skilld.dev/gh/localstack/skills/localstack-lifecycle
last_updated: 2026-09-26T05:24:56.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install localstack/skills/localstack-lifecycle`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/localstack-lifecycle`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/localstack/skills/localstack-lifecycle) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/localstack-lifecycle`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/localstack-lifecycle --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/localstack-lifecycle --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# LocalStack Lifecycle Management

Manage the LocalStack emulator lifecycle — starting, stopping, and monitoring the local cloud environment — using `lstk`, the current LocalStack CLI.

## Capabilities

- Start LocalStack with custom configuration
- Stop, restart, and reset running LocalStack instances
- Check LocalStack status and health
- Manage the emulator volume and persisted state
- Authenticate against the LocalStack platform

## Prerequisites

- Docker installed and running
- A LocalStack account (`lstk` pulls the `localstack/localstack-pro` image and requires a valid license)
- The `lstk` CLI:

```bash
# Homebrew (macOS/Linux)
brew install localstack/tap/lstk

# npm
npm install -g @localstack/lstk

# Verify
lstk --version
```

> The legacy `localstack` CLI is deprecated and will be removed in a future version. Prefer `lstk`. A few features still live only in the legacy CLI — see [Legacy CLI fallbacks](#legacy-cli-fallbacks).

## Authentication

```bash
# Interactive browser login; stores the token in the system keyring
lstk login

# Remove stored credentials
lstk logout
```

In CI or any non-TTY environment, set the auth token instead (a CI Auth Token — a personal Developer Auth Token will not work in CI):

```bash
export LOCALSTACK_AUTH_TOKEN=<token>
lstk --non-interactive start
```

Token resolution order: system keyring (from `lstk login`) → `LOCALSTACK_AUTH_TOKEN` → interactive browser login. The keyring wins over the environment variable, so run `lstk logout` first if you need to switch.

## Common Commands

### Start LocalStack

```bash
# Start the emulator (bare `lstk` is equivalent to `lstk start`)
lstk start

# Start and keep state across restarts
lstk start --persist

# Start with debug logging (note the LOCALSTACK_ prefix)
LOCALSTACK_DEBUG=1 lstk start

# Pick the emulator type
lstk start --type aws          # also: snowflake, azure

# Plain output for scripts/CI, with a startup deadline
lstk --non-interactive --timeout 90s start
```

`lstk start` runs the container in the background and returns once the emulator is ready — there is no `-d` flag.

### Check Status

```bash
# Emulator state plus the resources currently deployed in it
lstk status

# Plain-text output for scripts
lstk --non-interactive status

# Service health endpoint
curl http://localhost:4566/_localstack/health | jq
```

### Stop and Restart

```bash
lstk stop
lstk restart
lstk restart --persist
```

### Reset State

```bash
# Discard all in-memory resources; the emulator keeps running
lstk reset
lstk reset --force        # skip the confirmation prompt
```

### View Logs

```bash
lstk logs                 # print available logs
lstk logs -f              # follow in real time
lstk logs -n 100          # last 100 lines
lstk logs -v              # unfiltered output
```

### Manage the Volume

```bash
lstk volume path          # print the volume directory
lstk volume clear         # wipe certificates, cached tools, persisted data
lstk volume clear --force
```

`lstk reset` clears in-memory state; `lstk volume clear` wipes the on-disk volume. Stop the emulator before clearing the volume.

## Configuration

### Passing environment variables

`lstk` forwards **host environment variables prefixed with `LOCALSTACK_`** into the emulator. Any LocalStack config variable you used to pass bare must now carry that prefix:

```bash
LOCALSTACK_DEBUG=1 lstk start
LOCALSTACK_SERVICES=s3,sqs lstk start
LOCALSTACK_ENFORCE_IAM=soft lstk start
```

The host `LOCALSTACK_AUTH_TOKEN` is deliberately *not* forwarded, so it cannot override the token `lstk` resolved.

### Environment profiles in `config.toml`

For settings you want on every run, define named profiles in `config.toml` and reference them from the container block. Keys inside a profile do **not** need the `LOCALSTACK_` prefix:

```toml
[[containers]]
type = "aws"
tag  = "latest"
port = "4566"
env  = ["debug", "ci"]

[env.debug]
DEBUG = "1"
PERSISTENCE = "1"

[env.ci]
SERVICES = "s3,sqs"
EAGER_SERVICE_LOADING = "1"
```

Config file resolution order: `./.lstk/config.toml` (project-local) → `$HOME/.config/lstk/config.toml` → OS default location. Print the active path with `lstk config path`.

### Common configuration options

| Variable | Description | How to set |
|----------|-------------|------------|
| `DEBUG` | Enable debug logging | `LOCALSTACK_DEBUG=1 lstk start` or `[env.*]` profile |
| `PERSISTENCE` | Persist state across restarts | `lstk start --persist` (preferred) or profile |
| `SERVICES` | Limit the services started | `LOCALSTACK_SERVICES=s3,sqs lstk start` |
| `GATEWAY_LISTEN` | Bind address/ports | `GATEWAY_LISTEN = "0.0.0.0:4566"` in a profile |
| `LOCALSTACK_AUTH_TOKEN` | Platform auth token | Env var, or `lstk login` |
| `LOCALSTACK_HOST` | Override the endpoint host used by `lstk aws` and friends | Env var |

Pin an image version with `tag` in `config.toml` (e.g. `tag = "2026.4"`), or point `image` at an internal registry for air-gapped setups.

## Legacy CLI fallbacks

`lstk` does not cover every legacy feature yet. Install the legacy CLI (`pip install localstack`) alongside `lstk` only if you need:

- **Extensions** — there is no `lstk extensions` command suite; see the `localstack-extensions` skill
- **`localstack aws iam stream` / `summary`** — IAM policy stream and summary; see the `localstack-iam` skill
- **Advanced DNS configuration** (systemd-resolved integration) and ephemeral cloud instances

`lstk` manages its own Docker container and cannot be mixed with a Docker Compose LocalStack setup, or with a container started by the legacy `localstack start`. To point `lstk` at an emulator you manage yourself, use `--endpoint-url`.

## Troubleshooting

- **`Error: runtime not healthy`**: Docker is not running. Start Docker Desktop or the daemon, or set `DOCKER_HOST` for a custom socket.
- **Port 443 conflict**: set `GATEWAY_LISTEN = "0.0.0.0:4566"` in an environment profile so only 4566 is bound.
- **Auth errors in CI**: set `LOCALSTACK_AUTH_TOKEN` before `lstk start`; a TTY-less environment cannot run the browser flow.
- **Stale license**: `lstk logout && lstk login`.
- **Unknown env var had no effect**: confirm it is prefixed with `LOCALSTACK_` on the host, or moved into an `[env.*]` profile.
- **Diagnostics**: `lstk` writes `lstk.log` next to the config file — find it with `lstk config path`.
