drift
alchemy drift [options]Re-observe every deployed resource and compare the live cloud state against what alchemy last persisted. The result renders exactly like a deploy plan: unchanged resources are no-ops, out-of-band edits show as drifted, and resources deleted behind alchemy’s back show as missing.
By default, drift only reports changes. In a terminal it asks whether to
repair them. Pass --repair (or --yes) to restore drifted and missing
resources to the last deployed state without asking. Alchemy reads the cloud
state again before applying the repair.
A repair doesn’t recompute the stack’s outputs, because drift never runs
the stack program. Run alchemy deploy afterwards to refresh them.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
No drift, or the drift was repaired |
1 |
The check failed, e.g. a resource couldn’t be read |
2 |
Drift was found and not repaired |
A scheduled job can alert on 2 without parsing the plan.
| Option | Description |
|---|---|
--repair |
Repair detected drift without prompting |
--stage <name> |
Stage to check (defaults to $ALCHEMY_STAGE or live_$USER) |
--yes |
Answer the repair prompt with yes (same as --repair) |
--profile <name> |
Auth profile to use (defaults to $ALCHEMY_PROFILE or default) |
--env-file <path> |
Load environment variables from a file |
--config, -c <file> |
Stack file to check (defaults to alchemy.run.ts) |
Examples
Section titled “Examples”# Report drift for the default stagealchemy drift
# Check productionalchemy drift --stage prod
# Check prod from a scheduled job; exits 2 when it has driftedalchemy drift --stage prod
# Repair drift without an interactive promptalchemy drift --stage prod --repairWhere next
Section titled “Where next”- plan previews desired-state changes instead of drift
- Resource Lifecycle explains how reconcile updates observed state
- Inspecting State explains how to inspect Alchemy’s deployment record