You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# expose_ports = [] # Extra container ports to publish (e.g. [53] for the DNS server)
179
180
# env = [] # Named environment profiles to apply (see [env.*] sections below)
180
181
# snapshot = "" # Snapshot REF to auto-load after start (AWS only)
181
182
```
@@ -187,9 +188,11 @@ port = "4566" # Host port the emulator will be accessible on
187
188
|`type`| string |`"aws"`| Emulator type. One of `"aws"`, `"snowflake"`, `"azure"`. Run a single `[[containers]]` block at a time. See [Emulator types](#emulator-types). |
188
189
|`tag`| string |`"latest"`| Docker image tag (`"latest"`, `"2026.4"`, etc.). Useful for pinning a specific version. Zero-padded months (`"2026.04"`) are normalized to `"2026.4"`. |
189
190
|`port`| string |`"4566"`| Host port the emulator listens on (1–65535). The in-container port is always `4566`. |
191
+
|`container_name`| string | (derived) | Override the derived container name (default `localstack-<type>`, plus `-<tag>` when `tag` is not `latest`). Set it when something outside `lstk` addresses the emulator by a fixed name. It is also what the emulator reports as `MAIN_CONTAINER_NAME`. |
190
192
|`image`| string | (default) | Full image reference that overrides the default Docker Hub image, e.g. an internal-registry mirror or a locally loaded offline image. If it already carries a tag, `tag` is ignored; otherwise `tag` (or `latest`) is appended. |
191
193
|`volume`| string | (OS cache) | Host directory for persistent emulator state. Defaults to `<os-cache>/lstk/volume/<container-name>`. See also `volumes`. |
192
194
|`volumes`| string[]|`[]`| Docker-style `"host:container[:ro]"` bind mounts (e.g. init hooks). May also carry the persistence mount (target `/var/lib/localstack`). See [Volume mounts](#volume-mounts). |
195
+
|`expose_ports`| int[]\| string[]|`[]`| Extra container ports to publish that the gateway and service-port ranges don't already cover, e.g. `expose_ports = [53]` for the emulator's DNS server. See [Exposing extra ports](#exposing-extra-ports). |
193
196
|`env`| string[]|`[]`| List of named environment profiles to inject into the container (see below). |
194
197
|`snapshot`| string |`""`| Snapshot REF (e.g. `pod:my-baseline` or a local path) to auto-load after the emulator starts. AWS emulator only. See [Auto-loading a snapshot on start](#auto-loading-a-snapshot-on-start). |
195
198
@@ -290,6 +293,21 @@ volumes = [
290
293
291
294
`volume` and `volumes` overlap only for the persistence mount: `volume` can *only* set the persistence directory, while `volumes` is a superset that can also express init hooks and other mounts.
292
295
296
+
### Exposing extra ports
297
+
298
+
`lstk` publishes the emulator's gateway port and the standard service-port range automatically.
299
+
To publish a container port outside that set — for example port `53` so the emulator's DNS server can act as the host's resolver — list it under `expose_ports`:
300
+
301
+
```toml
302
+
[[containers]]
303
+
type = "aws"
304
+
port = "4566"
305
+
expose_ports = [53, "5354:5353/udp"]
306
+
```
307
+
308
+
Each entry is either a bare port number (published on the same host port) or a Docker-style `"[host:]container[/proto]"` string.
309
+
An entry that names no protocol is published for both TCP and UDP.
310
+
293
311
### Using a project-local config
294
312
295
313
Place a `.lstk/config.toml` in your project directory.
@@ -552,6 +570,7 @@ The exit code and `stdout`/`stderr` of the underlying `aws` process are passed t
|`--account <id>`| Target a specific LocalStack account by 12-digit id, placed before the `aws` subcommand. Falls back to `AWS_ACCESS_KEY_ID`, then the default account `000000000000`. See [Selecting the account](#selecting-the-account). |
555
574
|`--non-interactive`| Suppress the loading spinner. Unlike other commands, this flag is stripped before invoking `aws` (not forwarded). |
556
575
557
576
:::note
@@ -574,6 +593,18 @@ By default, `lstk` probes whether `localhost.localstack.cloud` resolves to `127.
574
593
Set [`LOCALSTACK_HOST`](#environment-variables) to override the host:port used to reach LocalStack and skip the DNS probe.
575
594
The port comes from the AWS container's `port` in `config.toml` (default `4566`).
576
595
596
+
#### Selecting the account
597
+
598
+
LocalStack derives the AWS account from the access key id it receives: 12 digits map to that account, anything else maps to the default account `000000000000`.
599
+
Pass `--account <id>` (12 digits) in leading position — between the command name and the `aws` subcommand — to target a specific account:
When `--account` is not set, `lstk` falls back to the ambient `AWS_ACCESS_KEY_ID`, then to the default account.
606
+
The same `--account` flag is available on [`lstk terraform`](#terraform) and [`lstk sam`](#sam); `lstk cdk` does not accept it, because the CDK resolves the account through its own STS round-trip that did not track the flag reliably.
607
+
577
608
### `az`
578
609
579
610
Run Azure CLI commands against the running LocalStack Azure emulator.
@@ -679,7 +710,7 @@ When you interrupt a proxied tool (for example Ctrl+C or `kill` during `lstk ter
679
710
680
711
Manage emulator snapshots.
681
712
A snapshot captures the running emulator's state, either as a local file on disk, as a Cloud Pod on the LocalStack platform, or in your own S3 bucket.
682
-
The `snapshot` command groups five subcommands — `save`, `load`, `list`, `remove`, and `show`. The first two are also exposed as the top-level aliases `lstk save` and `lstk load`.
713
+
The `snapshot` command groups six subcommands — `save`, `load`, `list`, `remove`, `show`, and `versions`. The first two are also exposed as the top-level aliases `lstk save` and `lstk load`.
683
714
684
715
:::note
685
716
Snapshots are best supported on the **AWS emulator**.
# Load from your own S3 bucket (pod name is required)
743
777
lstk snapshot load my-pod s3://my-bucket/prefix
744
778
@@ -822,10 +856,30 @@ Show metadata for a single Cloud Pod snapshot on the LocalStack platform: its na
822
856
This subcommand is cloud-only and requires authentication.
823
857
824
858
```bash
859
+
# Latest version
825
860
lstk snapshot show pod:my-baseline
861
+
862
+
# A specific version
863
+
lstk snapshot show pod:my-baseline:3
864
+
```
865
+
866
+
The required `REF` argument must be a `pod:<name>` Cloud Pod reference, optionally with a `:<version>` suffix (the latest version is shown when omitted).
867
+
868
+
#### `snapshot versions`
869
+
870
+
List the version history of a Cloud Pod.
871
+
Every save to an existing Cloud Pod adds a new version; `versions` prints each one with its version number, created date, LocalStack version, and services.
872
+
This subcommand is cloud-only and requires authentication.
873
+
874
+
```bash
875
+
lstk snapshot versions pod:my-baseline
826
876
```
827
877
828
878
The required `REF` argument must be a `pod:<name>` Cloud Pod reference.
879
+
Only Cloud Pods have versions — local files and `s3://` remotes do not, and passing a `:<version>` suffix here is rejected.
880
+
881
+
Append a `:<version>` to a `pod:` reference to act on that version specifically.
882
+
[`load`](#snapshot-load) and [`show`](#snapshot-show) accept it; [`save`](#snapshot-save), [`remove`](#snapshot-remove), `versions`, and `s3://` remotes reject a version suffix rather than ignore it.
829
883
830
884
#### S3 remotes
831
885
@@ -1197,6 +1251,7 @@ These options are available for all commands:
|`--config <path>`| Path to a specific TOML config file |
1254
+
|`--endpoint-url <url>`| Target an existing, externally-managed emulator at this URL instead of discovering one via local Docker. See [Targeting an external emulator](#targeting-an-external-emulator). |
1200
1255
|`--non-interactive`| Disable the interactive TUI, use plain output |
1201
1256
|`--json`| Emit a single machine-readable JSON envelope on stdout instead of human-oriented output. Supported by `stop`, `reset`, and `update`; any other command rejects it. See [Structured output](#structured-output). |
1202
1257
|`--persist`| Persist emulator state across restarts (on `start`/bare `lstk` and `restart`) |
@@ -1207,6 +1262,25 @@ These options are available for all commands:
1207
1262
|`-v`, `--version`| Print the version and exit |
1208
1263
|`-h`, `--help`| Print help and exit |
1209
1264
1265
+
## Targeting an external emulator
1266
+
1267
+
By default `lstk` discovers the emulator through the local Docker daemon.
1268
+
To run a command against an emulator `lstk` did not start — one managed by Docker Compose, running in host-network mode, in CI, on another machine, or a LocalStack cloud-hosted ephemeral instance — point `lstk` at the emulator's URL with the global `--endpoint-url` flag or the `LSTK_ENDPOINT_URL` environment variable:
1269
+
1270
+
```bash
1271
+
lstk aws --endpoint-url http://localhost:4566 s3 ls
1272
+
LSTK_ENDPOINT_URL=https://<id>.localstack.run lstk status
1273
+
```
1274
+
1275
+
- Both `http://` and `https://` URLs are accepted (any other scheme is rejected). The scheme is preserved end to end, which is what makes `https://` ephemeral instances work.
1276
+
- Source precedence is the `--endpoint-url` flag, then `LSTK_ENDPOINT_URL`, then `AWS_ENDPOINT_URL` (a lower-priority synonym).
1277
+
- The emulator type (AWS, Azure, or Snowflake) is auto-detected by probing the endpoint; there is no manual override.
1278
+
1279
+
The following commands accept an endpoint: `aws`, `az`, `terraform`/`tf`, `cdk`, `sam`, `snapshot save`/`load` (and the `save`/`load` aliases), `snapshot remove`, `snapshot list s3://…`, `reset`, and `status`.
1280
+
The AWS-only proxies (`terraform`, `cdk`, `sam`) reject a detected non-AWS emulator.
1281
+
1282
+
Commands that operate on a local Docker container or local filesystem state have no remote equivalent and reject any endpoint source: `start` (and the bare `lstk`), `stop`, `restart`, `logs`, and `volume`.
1283
+
1210
1284
## Interactive and non-interactive mode
1211
1285
1212
1286
`lstk` automatically selects its output mode:
@@ -1300,10 +1374,12 @@ The following environment variables configure `lstk` itself (not the LocalStack
|`LOCALSTACK_AUTH_TOKEN`| Auth token for non-interactive runs or to skip browser login. Used when no keyring token is stored. |
1377
+
|`LOCALSTACK_AUTH_TOKEN`| Auth token for non-interactive runs or to skip browser login. Takes precedence over a token stored in the keyring.|
1304
1378
|`LOCALSTACK_HOST`| Override the host (and optional port) used when resolving and printing the emulator endpoint, and when writing the AWS CLI profile. Bypasses the `localhost.localstack.cloud` DNS probe. |
1379
+
|`LSTK_ENDPOINT_URL`| Target an existing, externally-managed emulator at this URL instead of discovering one via local Docker. Equivalent to `--endpoint-url`; `AWS_ENDPOINT_URL` is honored as a lower-priority synonym. See [Targeting an external emulator](#targeting-an-external-emulator). |
1305
1380
|`LOCALSTACK_DISABLE_EVENTS`| Set to `1` to disable anonymous telemetry event reporting. |
1306
-
|`DOCKER_HOST`| Override the Docker daemon socket (e.g. `unix:///home/user/.colima/default/docker.sock`). |
1381
+
|`DOCKER_HOST`| Override the Docker daemon socket (e.g. `unix:///home/user/.colima/default/docker.sock`). Always wins over auto-detection. |
1382
+
|`DOCKER_CONTEXT`| Select a Docker CLI context to resolve the daemon from, when `DOCKER_HOST` is not set. A stale or unreachable context is skipped rather than failing. |
1307
1383
|`LSTK_KEYRING`| Set to `file` to force file-based token storage instead of the system keyring. |
1308
1384
|`LSTK_STARTUP_TIMEOUT`| Startup readiness deadline for `lstk start`, as a Go duration (e.g. `90s`, `2m`). Zero/unset uses the per-mode default (20s interactive, 60s non-interactive). See [`start`](#start). |
1309
1385
|`LSTK_MERGE_STRATEGY`| Default merge strategy for `snapshot load` / `load` (`account-region-merge`, `overwrite`, or `service-merge`) when `--merge` is not passed. An explicit `--merge` always wins. |
@@ -1312,7 +1388,7 @@ The following environment variables configure `lstk` itself (not the LocalStack
1312
1388
|`LSTK_API_ENDPOINT`| Override the LocalStack platform API base URL. Default: `https://api.localstack.cloud`. |
1313
1389
|`LSTK_WEB_APP_URL`| Override the LocalStack Web Application URL used for browser login. Default: `https://app.localstack.cloud`. |
1314
1390
1315
-
When `DOCKER_HOST` is not set, `lstk`tries the default Docker socket and then probes common alternatives (Colima at `~/.colima/default/docker.sock` or `~/.config/colima/default/docker.sock`, OrbStack at `~/.orbstack/run/docker.sock`).
1391
+
When `DOCKER_HOST` is not set, `lstk`resolves the Docker daemon in order: an active `DOCKER_CONTEXT` or the current non-default Docker CLI context, then a live Docker socket, then a probe of common alternatives — Docker Desktop, Rancher Desktop, Colima (`~/.colima/default/docker.sock` or `~/.config/colima/default/docker.sock`), OrbStack (`~/.orbstack/run/docker.sock`), Podman, and Lima. `lstk` dials each candidate rather than only checking for a socket file, so a leftover socket never shadows a live daemon, and a stale or unreachable context is skipped rather than failing the command.
1316
1392
1317
1393
When `LSTK_OTEL` is enabled, the standard `OTEL_EXPORTER_OTLP_*` environment variables are honored by the OpenTelemetry SDK.
1318
1394
@@ -1429,6 +1505,9 @@ lstk completion fish > ~/.config/fish/completions/lstk.fish
1429
1505
1430
1506
Restart your shell after persisting completions.
1431
1507
1508
+
Once `lstk`'s completion is installed, `lstk aws <TAB>` also completes AWS services, operations, and parameters by delegating to the AWS CLI's own completer.
1509
+
This works in every shell `lstk completion` supports and requires no separate `complete -C aws_completer` registration.
0 commit comments