Sub topic 13
Handling drift and updating the landing zone
This chapter covers what drift is in AWS Control Tower, how to detect and repair it, and how to update a landing zone to a new version. It assumes you have launched a landing zone, you understand OUs and controls, and you can use the AWS CLI and the console. You should also know that Control Tower creates and manages resources through AWS Organizations, AWS Config, AWS CloudFormation and IAM.
What drift means
Control Tower manages a set of resources on your behalf. These include the OU structure, the Log Archive and Audit accounts, IAM roles, AWS Config recorders, CloudTrail trails, and the resources behind each enabled control. Drift is any change to those resources that moves them away from the state Control Tower expects.
Drift usually has one of these causes:
- An administrator edits or deletes a Control Tower role, a CloudTrail trail, or an AWS Config setting by hand.
- Someone moves an account between OUs in AWS Organizations instead of using Control Tower or Account Factory.
- Someone attaches, detaches, or edits an SCP that Control Tower created.
- Someone removes a Control Tower-managed OU or renames it in a way Control Tower can't track.
- A resource is changed by a script or another automation tool that is unaware of Control Tower.
Not every change is drift. You can add your own SCPs to an OU, create your own resources in member accounts, and add more AWS Config rules. Control Tower only cares about the resources it owns.
Types of drift
Drift appears at two levels: the landing zone as a whole, and individual controls or accounts.
| Level | Example | How it shows up | Typical repair |
|---|---|---|---|
| Landing zone | A Control Tower IAM role in the management account is deleted. | The landing zone status shows drift. | Repair the landing zone. |
| OU or account | An account is moved out of a registered OU using Organizations. | The account or OU shows as drifted. | Move it back, or re-register the OU. |
| Control | A control's SCP is detached from an OU. | The enabled control shows a drifted status. | Re-enable the control. |
Some drift can't be repaired by Control Tower alone. If the repair needs a resource you deleted, such as a shared account, you may need to restore that resource first, or contact AWS Support.
How Control Tower detects drift
Control Tower runs periodic checks and also reacts to certain events. It reads lifecycle events from AWS Organizations and CloudTrail, and it compares the current state of the managed resources with its expected state. When it finds a mismatch, it records the drift and shows it in the console. It can also send a notification through the Control Tower SNS topic, which lives in the Audit account.
You can see drift from three places:
- The Control Tower dashboard shows a summary of non-compliant resources and drift.
- The landing zone settings page shows the landing zone's drift status.
- The AWS CLI returns a
driftStatusfield on landing zones and enabled controls.
Detection isn't instant. Allow some time after a change before expecting the status to update.
Checking drift from the CLI
The get-landing-zone call returns the landing zone's status and drift status. Use the home Region, because that's where the landing zone lives.
aws controltower list-landing-zones --region us-east-1
aws controltower get-landing-zone \
--landing-zone-identifier <landing-zone-arn> \
--region us-east-1In the response, look at these fields:
statusisACTIVE,PROCESSING, orFAILED.driftStatus.statusisIN_SYNCorDRIFTED.versionis the version the landing zone currently runs.latestAvailableVersionis the newest version you can update to.
If driftStatus.status is DRIFTED, don't change anything yet. First work out what changed and why.
For controls on an OU, list the enabled controls and check each one's drift status.
aws controltower list-enabled-controls \
--target-identifier <ou-arn> \
--region us-east-1You can then call get-enabled-control with an enabled control's ARN to see its driftStatusSummary and its status.
Investigating before you repair
Repair overwrites the manual change. If the change was deliberate, such as a security team adjusting a role, repair may undo it. Follow this order:
- Read the drift message in the console. It names the resource and the kind of change.
- Search CloudTrail in the management account for the API call that caused it. Look at the user or role, the time, and the request.
- Decide whether the change was intentional. If it was, plan how to meet that need in a supported way, such as a custom control, an SCP of your own, or a customization.
- Only then repair.
Repairing drift
How you repair depends on where the drift is.
Landing zone drift. In the console, open the landing zone settings and choose the repair action. Control Tower reapplies its expected configuration. The landing zone moves to PROCESSING while it works, and back to ACTIVE when it finishes. In the API, the equivalent is reset-landing-zone, which reapplies the current manifest.
aws controltower reset-landing-zone \
--landing-zone-identifier <landing-zone-arn> \
--region us-east-1This call returns an operation identifier. Track it with get-landing-zone-operation.
aws controltower get-landing-zone-operation \
--operation-identifier <operation-id> \
--region us-east-1Control drift. Re-enable the control. The reset-enabled-control call reapplies the control to its target.
aws controltower reset-enabled-control \
--enabled-control-identifier <enabled-control-arn> \
--region us-east-1OU and account drift. Move the account back to the registered OU, or re-register the OU in Control Tower so it enrolls the accounts again. Control Tower can't always fix these automatically, because the right target depends on your intent.
Only one landing zone operation runs at a time. Don't start a second one while the first is PROCESSING.
Updating the landing zone
AWS releases new landing zone versions that add features, fix defects, or change managed resources. A landing zone doesn't update itself. You choose when to update. Check latestAvailableVersion against version from get-landing-zone, or watch for the update banner in the console.
What an update does
An update can change the Log Archive and Audit account resources, the Config and CloudTrail setup, the IAM roles, and the set of governed Regions or the other settings you modify at the same time. Control Tower applies the changes with CloudFormation StackSets and Organizations calls. It can also re-evaluate each enrolled account, so large organizations see long run times.
Before you update
- Fix drift first. An update on a drifted landing zone can fail, or it can carry the drift forward.
- Read the release notes for the new version.
- Confirm the management account has no pending changes such as a half-finished account enrollment.
- Check that no SCP you wrote blocks the Control Tower roles from acting in member accounts.
- Confirm that AWS Config is enabled and recording where you expect.
- Schedule the update outside busy hours for your account provisioning.
Running the update
In the console, choose to update the landing zone, review the settings, and confirm. You can also change governed Regions in the same flow. With the API, pass the new version and the manifest.
aws controltower update-landing-zone \
--landing-zone-identifier <landing-zone-arn> \
--landing-zone-version <new-version> \
--manifest file://manifest.json \
--region us-east-1The manifest is a JSON document that holds your landing zone settings, such as governed Regions, the logging configuration, and the access management setting. Retrieve the current manifest from get-landing-zone and edit only what you intend to change.
Track the operation with get-landing-zone-operation until it reports SUCCEEDED or FAILED.
Common errors and how to handle them
| Symptom | Likely cause | What to do |
|---|---|---|
| Update fails and the landing zone shows `FAILED` | A Control Tower role was changed, or an SCP blocks it. | Fix the role or SCP, then retry the repair or update. |
| Repair completes but drift returns | Automation keeps reverting the setting. | Find and stop the automation. |
| Operation rejected as already running | Another landing zone operation is `PROCESSING`. | Wait for it to finish. |
| An account stays in an unexpected OU | It was moved with Organizations directly. | Move it back, or re-enroll it. |
| Controls show drift after an OU change | The SCP or Config rule attachment changed. | Reset the enabled control. |
| Update is slow | Many accounts and Regions to process. | Wait. Don't start a second operation. |
Good habits
- Check drift on a schedule. A weekly check from a script or a notification subscription is enough for most teams.
- Limit who can change Control Tower resources. Use an SCP to protect the Control Tower roles and the Config and CloudTrail resources, and keep manual edits to a small group.
- Do all account moves through Control Tower and Account Factory.
- Keep the landing zone within a few versions of the latest. Large version jumps carry more change at once.
- Record the reason for any deliberate exception, so a later repair doesn't remove it unnoticed.
Exercise
A security engineer edits a Control Tower-managed IAM role in the management account, and the landing zone now shows DRIFTED. List the steps you take before and after repair, and say why you shouldn't update to a newer landing zone version first.
Show answer
First, read the drift message and search CloudTrail in the management account for the edit. Confirm whether it was intentional. If it was, find a supported way to meet the need, such as your own SCP or a customization. Then run a landing zone repair (reset-landing-zone in the API) and track it with get-landing-zone-operation until it is ACTIVE and in sync. Update only after that. An update on a drifted landing zone can fail or carry the drift forward, and a failed update is harder to diagnose than a failed repair.
Exercise
Which CLI fields in get-landing-zone tell you that an update is available, and what command tracks the update after you start it?
Show answer
Compare version with latestAvailableVersion in the get-landing-zone response. If latestAvailableVersion is newer, an update is available. After you run update-landing-zone, it returns an operation identifier, and you track it with get-landing-zone-operation until the status is SUCCEEDED or FAILED.