Detecting Drift
Users can use drift detection to verify that the deployed stack definition matches the actual state of the resources.
Managing Stack Drift
You can detect, review, and resolve drift in resources managed by the stack.
Detecting Stack Drift
You can detect whether the actual state of the resources managed by the stack differs from the template definition. To detect stack drift, follow these steps.
- Click the All Services > Management > Infrastructure Builder menu. Navigates to the Service Home page.
- On the Service Home page, click the Stacks > Stack List menu. Navigates to the Stack List page.
- On the Stack List page, click the stack to detect drift. Navigates to the Stack Details page.
- On the Stack Details page, click the Drift Detection button. A confirmation popup is displayed.
- You can also select Drift Detection from the stack’s More (⋮) menu on the Stack List page.
- Click the Confirm button in the popup. Drift detection begins, and you can check the results in the notification at the top right of the screen upon completion.
- After detection is complete, check the results in the Drift Status area at the top of the Stack Details page.
Category Detailed Description Drift state Drift status of the entire stack - In Sync: The state of the actual resource matches the template definition
- Drifted: The state of the actual resource differs from the template definition
- Not Checked: Not verified because drift detection has not been run
- Unknown: Drift status cannot be determined
Drift duration The time when drift detection was last executed. - Not displayed in the Not Checked state.
- Hover over the time to display a tooltip.
Table. Stack drift status items
- Drift detection can be run when the stack state is Create Completed, Update Completed, Update Rollback Completed, Update Rollback Failed, or Delete Failed.
- Drift status is determined based on the time when detection is executed. After making changes to resources, run drift detection again to check the latest state.
View drift details
You can check which resources have detected drift and which properties differ. To view drift details, follow these steps.
- Click the All Services > Management > Infrastructure Builder menu. Navigates to the Service Home page.
- On the Service Home page, click the Stacks > Stack List menu. Navigates to the Stack List page.
- Click a stack on the Stack List page. Navigates to the Stack Details page.
- On the Stack Details page, click the Drift tab.
- Only resources that currently support drift detection are available in the Drift tab. View all stack resources in the Resources tab.
- Check the drift status for each resource.
Category Detailed Description Logical ID The name of the resource defined in the template Physical ID The unique ID of the resource that was actually created Service Service to which the resource belongs Resource Type Resource Types Resource Drift Status Drift status of the resource - Modified: The expected and actual attribute values differ (drift details available)
- Deleted: The resource itself has been deleted
- In Sync: The expected and actual configurations match
- Not Checked: Drift has not been checked
- Unknown: The status cannot be determined
- Unsupported: Drift detection is not supported for this resource
Drift check time Time drift was detected Drift Cause Causes of drift Table. Resource drift items- You can search by logical ID and physical ID. You can specify conditions by logical ID, physical ID, service, resource type, resource drift status, drift check time, and drift reason in Detailed Search.
- Select Resource Drift Details from the More (⋮) menu for the resource where drift was detected. The Resource Drift Details popup is displayed.
- You can view detailed information only for resources whose resource drift status is Modified.
- Check the differences in the popup.
Category Detailed Description Property Properties where the template definition differs from the actual state Change Change Type Expected value Values defined in the template Current Value The value configured on the actual resource Table. Drift difference items- Selecting a property in the difference list allows you to compare and verify the corresponding difference in the Expected and Current areas.
The change types are as follows.
| Change Type | Description | Display |
|---|---|---|
| Add | When a value is added to an array or list-type property (for example, when an additional inbound rule is added to a security group) | Green |
| Remove | If the property is removed from the current resource configuration | Red |
| Not Equal | When a value exists but differs from the expected value (for example, when the instance type changes from s1v2m2 to s1v2m4) | Blue |
Detecting resource drift
You can detect drift for specific resources rather than the entire stack. To detect resource drift, follow these steps.
- Click the All Services > Management > Infrastructure Builder menu. Navigates to the Service Home page.
- On the Service Home page, click the Stacks > Stack List menu. Navigates to the Stack List page.
- Click a stack on the Stack List page. Navigates to the Stack Details page.
- On the Stack Details page, click the Drift tab.
- Select Resource Drift Detection from the More options (⋮) menu of the resource to detect drift. A confirmation popup is displayed.
- Click the Confirm button in the popup. Detection begins, and a success message is displayed upon completion.
Resolving Drift
If drift is detected, you can align the definition with the actual state.
There are two ways to resolve drift: Select based on whether the direct changes are intentional.
| Category | Detailed Description |
|---|---|
| Align the actual state with the template | Redeploy the resources according to the template definition.
|
| Align the template with the actual state | Modify the template to match the actual state of the resource
|
To resolve drift, follow these steps.
- Check which properties of which resources differ in the drift details.
- After determining the resolution method, modify the template as needed.
- Create a change set to review the changes.
- For more information about creating change sets, see Creating a Change Set.
- After reviewing the change type and deployment verification results, run the change set.
- Rerun drift detection and verify that the status changes to In Sync.
Managing Stack Set Drift
You can detect drift in stack instances within a stack set and review the results.
Detecting stack set drift
You can detect drift in stack instances within a stack set. To detect drift in a stack set, follow these steps.
- Click the All Services > Management > Infrastructure Builder menu. Navigates to the Service Home page.
- On the Service Home page, click the Stack Set > Stack Set List menu. Go to the Stack Set List page.
- On the Stack Set List page, click the stack set for which you want to detect drift. Navigates to the Stack Set Details page.
- On the Stack Set Details page, click the Drift Detection button. A confirmation popup is displayed.
- Click the Confirm button in the popup. Drift detection begins, and you can check the results in the notification at the top right of the screen upon completion.
- After detection is complete, check the drift status of the entire stack set in the Drift Status area at the top of the Stack Set Details page.
- Check the Account and region-specific drift status on the Stack Instances tab.
Category Detailed Description Account ID The account where the stack instance is deployed Legion The region where the stack instance is deployed Stack ID The ID of the stack instance Deployment Status Deployment status of the stack instance Last request ID The ID of the last operation request performed on the stack instance Status Reason Reason for deployment status Drift state Drift status of stack instances Drift check time Time drift was detected Table. Stack instance drift items
Check the stack set drift results
You can review the results of the drift detection task for the stack set and the drift details for each resource. To review the drift results of a stack set, follow these steps.
- Click the All Services > Management > Infrastructure Builder menu. Navigates to the Service Home page.
- On the Service Home page, click the Stack Set > Stack Set List menu. Go to the Stack Set List page.
- On the Stack Set List page, click the stack set. Navigates to the Stack Set Details page.
- Click the Work Requests tab, then select Stack Set Drift Information from the More (⋮) menu for the Detect Drifted work request.
- This option is available only when the job status is Detect Drifted.
- Check the detection results in the Stack Set Drift Information popup.
Category Detailed Description Work Request Status Status of the drift detection job Drift state Drift status of the entire stack set Drift check time Time drift was detected Confirmed instances and drift results The number of total instances, in-progress instances, failed stack instances, instances being synchronized, and drifted instances Table. Stack set drift information items - To check for resource drift per stack instance, select Stack Instance Operation Results from the More (⋮) menu of the operation request.
- Click the View Resource Drift Results button for the stack instance in the Stack Instance Operation Results popup.
- This option is available only if drift is detected in the stack instance.
- Check the drift status for each resource in the Resource Drift Results popup.
- For resources in the Drifted state, click the Resource Drift Details button to review the differences by property.
- For the difference items, refer to Viewing Drift Details.