Drift
Drift
Drift refers to a state in which the actual state of resources managed by a stack differs from the configuration defined in the template.
If you directly modify resources deployed with a stack using the Console or API, the template definition and the actual state become out of sync. Updating the stack in this state can lead to unintended results, so it is important to first use drift detection to identify any differences.
Drift Detection
When you run drift detection, it queries the current state of the resources in the stack and compares it with the settings defined in the template. You can review the comparison results at both the stack level and the individual resource level.
The drift state is as follows:
| Status | Description |
|---|---|
| In Sync | A state in which the actual state of a resource matches the definition in the template |
| Drifted | The actual state of the resource differs from the state defined in the template |
| Not Checked | Drift detection was not executed, so the status remains unverified. |
| Unknown | Unable to determine whether drift has occurred |
The detected differences are categorized by change type as Add (value added), Remove (property removed), and Not Equal (value mismatch), and can be verified by comparing the expected values in the template with the current values of the actual resource.
Drift Resolution
If drift is detected, you can align the definition with the actual state using one of the following two methods.
- Align the actual state with the template: Create a change set to redeploy the resources according to the template definition. Any direct changes are reverted to the template definition.
- Align the template with the actual state: If the changes you made are intentional, update the template to match the actual state and then generate a change set to apply the changes. Because resources may be replaced depending on the modified properties, verify whether the change set involves replacements before proceeding.
Stack Set Drift
You can also run drift detection on stack sets. Drift detection for a stack set determines the overall consistency of the stack set by checking the drift status of each stack instance.
For more information about stack sets, see Stack Sets.