State Management
3 minute read
LocalStack for Snowflake 1.0 release went out on May 22, 2025. We will be launching our general availability product for purchase on June 2nd, 2025. Interested in learning more? Visit our site.
Note: Version 0.3.0 and beyond are only available to customers who have been granted a Snowflake license from LocalStack. If you accessed Snowflake via your AWS Emulator without a Snowflake license in prior versions, please reach out to us here.
Introduction
State Management in LocalStack allows you to save and load the state of your LocalStack instance. LocalStack is ephemeral in nature, so when you stop and restart your LocalStack instance, all the data is lost. With State Management, you can save the state of your LocalStack instance and load it back when you restart your LocalStack instance.
State Management in LocalStack encompasses the following features:
- Export & Import State: Export and import the state of your LocalStack instance on your local machine as a local file.
- Persistence: Persist the state of your LocalStack instance on your local machine using a configuration variable.
State Management is an essential feature that supports various use-cases, such as pre-seeding your fresh LocalStack instance with data, sharing your LocalStack instance’s state with your team, fostering collaboration, and more.
Persistence
LocalStack’s Persistence mechanism enables the saving and restoration of the entire LocalStack state. It functions as a pause and resume feature, allowing you to take a snapshot of your LocalStack instance and save this data to disk. This mechanism ensures a quick and efficient way to preserve and continue your work with Snowflake resources locally.
To start snapshot-based persistence, launch LocalStack with the configuration option PERSISTENCE=1
. This setting instructs LocalStack to save all local Snowflake resources and their respective application states into the LocalStack Volume Directory. Upon restarting LocalStack, you’ll be able to resume your activities exactly where you left off.
LOCALSTACK_AUTH_TOKEN=... PERSISTENCE=1 IMAGE_NAME=localstack/snowflake localstack start
...
image: localstack/snowflake
environment:
- LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?}
- PERSISTENCE=1
volumes:
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
docker run \
-e LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?} \
-e PERSISTENCE=1 \
-v ./volume:/var/lib/localstack \
-p 4566:4566 \
localstack/snowflake
Note
Snapshots may not be compatible across different versions of LocalStack. It is possible that snapshots from older versions can be restored, but there are no guarantees as to whether LocalStack will start into a consistent state. We are actively working on a solution for this problem.Export/Import State
The Export/Import State feature enables you to export the state of your LocalStack instance into a file, and then later import it into another LocalStack instance. This feature is useful when you want to save your LocalStack instance’s state for later use.
Export the State
To export the state, you can run the following command:
$ localstack state export '<file-name>'
You can use the <file-name>
argument to specify a file path to export the state to. If you do not specify a file path, the state will be exported to the current working directory into a file named ls-state-export
.
Import the State
To import the state, you can run the following command:
$ localstack state import '<file-name>'
The <file-name>
argument is required and specifies the file path to import the state from. The file should be generated from a previous export.