Index of every page on this site: llms.txt
All skills
localstack avatar

/state-management

@3526362
by localstacklocalstack/skills16 stars
Run it yourself

Manage LocalStack state and snapshots with lstk. Use when users want to save, load, export, or import LocalStack state, work with Cloud Pods or S3-backed snapshots, or enable persistence across restarts.

  • 1 file
  • 6.6 KB
  • Updated 3 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/localstack/skills/state-management

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈55 tokens for metadata: the name and description. ≈1.6k when used: this file.

Description uses 2.8% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈222 characters, or 2.8%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

State Management

Save, load, and manage LocalStack state for reproducible development environments and state snapshots, using lstk snapshot and its lstk save / lstk load aliases.

Capabilities

  • Save and restore state as local snapshot files
  • Save and load state to/from Cloud Pods (LocalStack platform storage)
  • Save and load state to/from your own S3 bucket
  • Share state across teams via Cloud Pods
  • Auto-load a snapshot every time the emulator starts
  • Enable persistent state across container restarts

Prerequisites

  • lstk installed and authenticated (lstk login, or LOCALSTACK_AUTH_TOKEN in CI) — see the localstack skill
  • A running emulator for save (lstk load will start one for you if needed)

lstk save / lstk load replace the legacy localstack state export/import and localstack pod save/load commands with a single snapshot interface. The destination REF decides where the state goes.

Snapshot References (REF)

REF form Destination
(omitted) Auto-named local file ./snapshot-<timestamp>-<hex>.snapshot
./my-snapshot.snapshot Explicit local path
pod:my-baseline Cloud Pod on the LocalStack platform
pod:my-baseline:3 Version 3 of that Cloud Pod
my-pod s3://my-bucket/prefix Your own S3 bucket

Local Snapshots

Save

# Save to an auto-named file in the current directory
lstk save

# Save to a specific path (the .snapshot extension is added if omitted)
lstk save ./my-snapshot.snapshot
lstk save /tmp/my-state

# Limit the snapshot to a subset of services
lstk save --services s3,lambda

Load

# Loads ./my-baseline or ./my-baseline.snapshot
lstk load my-baseline

# Load from an explicit path
lstk load ./checkpoint.snapshot

Use Cases for Local Snapshots

  • Backup/restore: Save state before destructive operations
  • CI/CD pipelines: Commit snapshot files to version control for reproducible tests
  • Offline workflows: Work with snapshot files without cloud connectivity
  • Quick snapshots: Fast local save/restore during development

Cloud Pods

Cloud Pods store state on the LocalStack platform, enabling team collaboration and remote state management. They require authentication (lstk login or LOCALSTACK_AUTH_TOKEN).

Save to a Cloud Pod

lstk save pod:my-baseline

# Only part of the state
lstk save pod:my-baseline --services s3,lambda

Every save to an existing pod name creates a new version.

Load from a Cloud Pod

lstk load pod:my-baseline

# A specific version
lstk load pod:my-baseline:3

# Preview the changes without applying them (Cloud Pod refs only)
lstk load pod:my-baseline --dry-run

List, Inspect, and Remove

# Your Cloud Pods
lstk snapshot list

# Everything in your organisation
lstk snapshot list --all

# Metadata: created date, size, LocalStack version, per-service resource counts
lstk snapshot show pod:my-baseline
lstk snapshot show pod:my-baseline:3

# Version history
lstk snapshot versions pod:my-baseline

# Delete (cloud snapshots only, cannot be undone)
lstk snapshot remove pod:my-baseline
lstk snapshot remove pod:my-baseline --force

Use Cases for Cloud Pods

  • Team collaboration: Share consistent development environments across team members
  • Demo environments: Prepare and share demo-ready states
  • Cross-machine development: Access the same state from different machines

S3-Backed Snapshots

Store snapshots in a bucket you own. Credentials are read from AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, from --profile, or from the profile named by AWS_PROFILE — never put credentials in the URL.

lstk save my-pod s3://my-bucket/prefix
lstk save my-pod s3://my-bucket/prefix --profile my-aws-profile

lstk load my-pod s3://my-bucket/prefix

lstk snapshot list s3://my-bucket/prefix

Merge Strategies

lstk load controls how snapshot state combines with state already in the emulator:

Strategy Behavior
account-region-merge (default) Snapshot wins on overlapping (service, account, region)
overwrite Wipe running state, then load
service-merge Snapshot wins per resource; non-overlapping resources are combined
lstk load pod:my-baseline --merge=overwrite

You can also set LSTK_MERGE_STRATEGY instead of passing the flag.

Auto-Loading a Snapshot on Start

For the AWS emulator, set the snapshot field on the container block so a snapshot loads on every start:

[[containers]]
type     = "aws"
snapshot = "pod:my-baseline"

Override or skip it for a single run:

lstk start --snapshot pod:other-baseline
lstk start --no-snapshot

Local Persistence

For automatic persistence across restarts without explicit save/load:

lstk start --persist
lstk restart --persist

--persist injects LOCALSTACK_PERSISTENCE=1 and writes state to the mounted volume, which is reloaded on the next start. Find that directory with lstk volume path; wipe it with lstk volume clear.

You can also set PERSISTENCE = "1" in an [env.*] profile in config.toml to make it the default for every run.

Clearing State

# Discard in-memory resources, keep the emulator running
lstk reset

# Wipe the on-disk volume (stop the emulator first)
lstk volume clear

Comparison

Feature Local snapshot files Cloud Pods (pod:) Your S3 bucket (s3://)
Storage Local files LocalStack platform Your AWS account
Extra auth None beyond lstk LocalStack auth token AWS credentials
Team sharing Manual file sharing Built-in Via bucket permissions
Versioning Manual Built-in (snapshot versions) Manual
Offline use Yes No No

Note that lstk itself always requires a LocalStack account and license, regardless of which snapshot backend you use.

Best Practices

  • Use local snapshot files for development checkpoints and CI/CD pipelines
  • Use Cloud Pods for team collaboration and shared environments
  • Use descriptive names that indicate the state contents
  • Use --services to keep snapshots small when you only care about part of the stack
  • Use --dry-run before loading an unfamiliar Cloud Pod into a populated emulator
  • Use lstk start --persist for simple state retention across restarts

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 3526362. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 3 months ago

README badge

README badge for localstack/skills/state-management