Skip to content

Commit a58a0e1

Browse files
authored
Document 2026.03 state compatibility rule (#610)
1 parent 9ff4ee4 commit a58a0e1

3 files changed

Lines changed: 63 additions & 2 deletions

File tree

src/content/docs/aws/capabilities/config/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ To learn more about these configuration options, see [Persistence](/aws/capabili
397397
| `SNAPSHOT_SAVE_STRATEGY` | `ON_SHUTDOWN`\|`ON_REQUEST`\|`SCHEDULED`\|`MANUAL` | Strategy that governs when LocalStack should make state snapshots |
398398
| `SNAPSHOT_LOAD_STRATEGY` | `ON_STARTUP`\|`ON_REQUEST`\|`MANUAL` | Strategy that governs when LocalStack restores state snapshots |
399399
| `SNAPSHOT_FLUSH_INTERVAL` | 15 (default) | The interval (in seconds) between persistence snapshots. It only applies to a `SCHEDULED` save strategy (see [Persistence Mechanism](/aws/capabilities/state-management/persistence))|
400+
| `DISABLE_COMPATIBILITY_RULES` | `0` (default) \| `1` | Disable the [state compatibility rules](/aws/capabilities/state-management/persistence#state-compatibility) that prevent loading incompatible state into LocalStack. Applies to both snapshot persistence and Cloud Pods. |
400401

401402
## Cloud Pods
402403

src/content/docs/aws/capabilities/state-management/cloud-pods.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,10 @@ Loading a Cloud Pod with mismatching version might lead to a corrupted state of
669669
Do you want to continue? [y/N]:
670670
```
671671

672+
In addition to this prompt, Cloud Pods are subject to the [state compatibility rules](/aws/capabilities/state-management/persistence#state-compatibility) shared with snapshot-based persistence.
673+
Pods that were saved before `v2026.03` cannot be loaded into LocalStack `v2026.03` or later, because persistence was rewritten for several services in that release.
674+
Set `DISABLE_COMPATIBILITY_RULES=1` to bypass the checks at your own risk.
675+
672676
We are working to extend Cloud Pods support to all AWS services emulated in LocalStack.
673677
However, state management might not yet work reliably for every service.
674678

src/content/docs/aws/capabilities/state-management/persistence.mdx

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ docker run \
5252

5353
:::note
5454
Snapshots may not be compatible across different versions of LocalStack.
55-
It is possible that snapshots from older versions can be restored, but there are no guarantees to whether LocalStack will start into a consistent state.
56-
We are actively working on a solution for this problem.
55+
LocalStack applies [state compatibility rules](#state-compatibility) that block loading state files known to be incompatible with the running LocalStack version.
5756
:::
5857

5958
### Save strategies
@@ -116,6 +115,63 @@ curl -X POST localhost:4566/_localstack/state/save
116115
{"service": "s3", "status": "ok"}
117116
```
118117

118+
## State compatibility
119+
120+
The internal state format of LocalStack changes over time as services evolve.
121+
To prevent silently loading state into an incompatible runtime, LocalStack ships a set of compatibility rules that compare the LocalStack version recorded in the saved state with the version of the running container.
122+
The same rules apply to both [snapshot-based persistence](#configuration) and [Cloud Pods](/aws/capabilities/state-management/cloud-pods).
123+
124+
If a rule rejects the state, LocalStack does not load it and logs the reason.
125+
The rules currently enforced are:
126+
127+
| Rule | Behavior |
128+
| - | - |
129+
| Forward compatibility | Reject loading a state into a LocalStack version older than the one that produced it. |
130+
| First CalVer release (`v2026.03`) | Reject loading state saved before `v2026.03` into LocalStack `v2026.03` or later. Persistence was rewritten for several services in the first calendar-versioned release. |
131+
132+
Loading a state saved with `v2026.03` or later into a newer LocalStack version of the same series remains supported.
133+
For example, a state saved with `v2026.03` can be loaded into `v2026.03.1` or `v2026.04`.
134+
135+
### Disable compatibility checks
136+
137+
If you understand the risks and want LocalStack to load state regardless of these rules, start the container with `DISABLE_COMPATIBILITY_RULES=1`.
138+
This bypasses every compatibility rule and lets LocalStack attempt to load the state as-is.
139+
140+
<Tabs>
141+
<TabItem label="LocalStack CLI">
142+
```bash
143+
DISABLE_COMPATIBILITY_RULES=1 PERSISTENCE=1 localstack start
144+
```
145+
</TabItem>
146+
<TabItem label="Docker Compose">
147+
```yaml showLineNumbers
148+
image: localstack/localstack-pro
149+
environment:
150+
- LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?}
151+
- PERSISTENCE=1
152+
- DISABLE_COMPATIBILITY_RULES=1
153+
volumes:
154+
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
155+
```
156+
</TabItem>
157+
<TabItem label="Docker">
158+
```bash
159+
docker run \
160+
-e LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?} \
161+
-e PERSISTENCE=1 \
162+
-e DISABLE_COMPATIBILITY_RULES=1 \
163+
-v ./volume:/var/lib/localstack \
164+
-p 4566:4566 \
165+
localstack/localstack-pro
166+
```
167+
</TabItem>
168+
</Tabs>
169+
170+
:::caution
171+
Disabling compatibility rules can leave LocalStack in an inconsistent state.
172+
Use this option only for debugging or when migrating data with a tested workaround in place.
173+
:::
174+
119175
## Service coverage
120176

121177
Although we are working to support both snapshot-based persistence and Cloud pods for all AWS services,

0 commit comments

Comments
 (0)