Skip to content

drift

Terminal window
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.

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)
Terminal window
# Report drift for the default stage
alchemy drift
# Check production
alchemy drift --stage prod
# Check prod from a scheduled job; exits 2 when it has drifted
alchemy drift --stage prod
# Repair drift without an interactive prompt
alchemy drift --stage prod --repair
  • 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