Skip to main content
This lesson demonstrates how to detect configuration drift in AWS CloudFormation. Drift detection compares the live state of AWS resources with the desired state declared in your CloudFormation template. When live resource properties differ from the template, CloudFormation reports those resources as drifted. CloudFormation only checks the properties that the service exposes for drift detection, so not every resource property is verified.
Drift detection is read-only — it does not modify or reconcile resources. To restore alignment you must update the stack (via CloudFormation) or manually change the live resource to match the template.

Example template used in this demo

The sample CloudFormation template below creates an S3 bucket and assigns a single tag Author: Arno:

How drift detection works (console workflow)

To run drift detection from the CloudFormation console:
  • Open the CloudFormation console and select the stack you want to inspect.
  • From the stack’s top-right Stack actions menu choose View drift results.
  • On the Drift Results page click Detect stack drift.
When you first visit a stack’s drift results page that has never been checked, the stack-level status shows NOT_CHECKED and resource-level statuses will also show NOT_CHECKED until detection runs. After initiating detection, CloudFormation performs read-only checks against the live resources. You will get a notification that drift detection was initiated for your stack.
A screenshot of the AWS CloudFormation "Drifts" page showing a blue notification that drift detection was initiated for a DemoStack. The page shows "Stack drift status: NOT_CHECKED" and a prominent "Detect stack drift" button.

Example detection outcomes

After the check completes, the stack and resource statuses are updated. If the live resources match the template, you will see IN_SYNC:
Now imagine someone edits the S3 bucket in the S3 console and deletes the Author: Arno tag. That change causes a drift because the live resource no longer matches the template. Re-running drift detection will report the stack as DRIFTED and the S3 resource as MODIFIED because the tags differ from what’s declared in the template. To bring the stack back in sync, update the live resource so it matches the template — for example, add the Author: Arno tag back to the bucket (key and value must match exactly), then run drift detection again. Once the live resource matches the template, statuses return to IN_SYNC.
A screenshot of the AWS CloudFormation console on the DemoStack "Drifts" page, showing a resource drift status of "IN_SYNC" for an S3 bucket (MyBucket) and the last drift check timestamp.

Common statuses and meanings

CLI and SDK options

You can also run drift detection programmatically:

Best practices and limitations

Not all CloudFormation resource properties are supported by drift detection. Always consult the CloudFormation documentation for the specific resource to confirm which properties are detectable. Relying solely on drift detection for compliance can miss unsupported property changes.
  • Run drift detection regularly for critical stacks to catch out-of-band changes.
  • Combine drift detection with change-control processes and IAM controls to limit direct edits to resources created by CloudFormation.
  • Remediation requires either updating the template (if the change is intended) or updating the live resource to match the template.

Summary — key points

  • CloudFormation drift detection compares the template’s desired state with live resource properties that CloudFormation can inspect.
  • Run detection from the console (Stack actions → View drift results → Detect stack drift), via the AWS CLI, or through AWS SDKs.
  • Results include a stack-level status (NOT_CHECKED, IN_SYNC, DRIFTED) and per-resource statuses (IN_SYNC, MODIFIED, DELETED, etc.).
  • Drift detection is read-only — remediation must be done manually or by updating the stack/template.

Watch Video