Decommission an Account
Decommissioning an AWS account is a two-phase process:
- Remove Guardrails-managed infrastructure from the AWS account (event handlers, IAM resources, CloudTrail, logging buckets).
- Disconnect the account from the Guardrails workspace, removing all CMDB records and policy settings.
Prerequisites
Turbot/Ownerpermissions at the Turbot resource level.
Phase 1: Decommission Guardrails Infrastructure
Create the following policy settings on the target account to clean up Guardrails-managed resources. If you want to retain a particular resource (e.g., CloudTrail for compliance), skip that policy setting.
Allow time for Guardrails to complete each removal before proceeding to Phase 2.
| # | Policy | Value | What It Removes |
|---|---|---|---|
| 1 | AWS > IAM > User > Boundary | Enforce: No Boundary | Boundary policies from IAM users. |
| 2 | AWS > IAM > Role > Boundary | Enforce: No Boundary | Boundary policies from IAM roles. |
| 3 | AWS > Turbot > Permissions > Superuser Boundary | No Boundary | Guardrails-managed superuser boundary. |
| 4 | AWS > Turbot > Permissions > User Boundary | No Boundary | Guardrails-managed user boundary. |
| 5 | AWS > Turbot > Permissions | Enforce: None | Guardrails-managed IAM policies, groups, roles, and users. |
| 6 | AWS > Turbot > Audit Trail | Enforce: Not configured | Guardrails-managed CloudTrail. |
| 7 | AWS > Turbot > Event Handlers | Enforce: Not configured | Regional EventBridge rules and SNS topics. |
| 8 | AWS > Turbot > Event Handlers [Global] | Enforce: Not configured | Global EventBridge rules and SNS topics. |
| 9 | AWS > Turbot > Service Roles | Enforce: Not configured | Guardrails-managed IAM service roles. |
| 10 | AWS > Turbot > Logging > Bucket | Enforce: Not configured | Guardrails-managed logging S3 buckets. Buckets must be empty before deletion. Empty them via the AWS console if needed. |
| 11 | AWS > Turbot > Event Poller | Disabled | Stops event polling. Disable this after event handler cleanup is complete, since cleanup requires active polling. |
[!IMPORTANT] The order matters for steps 7–11. When event handlers are set to
Not configuredorSkip, the Event Poller re-enables automatically. Keep it running until event handler infrastructure is fully removed, then disable it.
Phase 2: Disconnect the Account
Once the controls from Phase 1 have completed:
-
Delete the
AWS > Account > Turbot IAM Role > External IDandAWS > Account > Turbot IAM Rolepolicy settings on the target account. -
Navigate to the account's resource page in the Guardrails console.
-
Select Actions in the top right, then Remove from Turbot.
-
In the confirmation dialog, type the account ID to confirm, then click Delete. Leave Retain history for deleted resources checked if you want to keep the account's control and resource history in Guardrails.

Guardrails removes the account, all child resources, controls, and policy settings. The time to complete depends on the number of resources. Larger accounts take longer.
[!NOTE] Disconnecting an account does not modify anything in the AWS account itself. It only removes the records from Guardrails.
Troubleshooting
The disconnection may time out if the account has a large number of resources. The goal is to reduce the resource count before retrying.
Manual Resource Count Reduction
- Navigate to the account's Resources tab to identify the largest resource types.
- For each large resource type, create a policy setting for
AWS > {Service} > {Resource Type} > CMDBset toEnforce: Disabled. This purges those CMDB entries. - Wait a few minutes for the purge to complete, then retry the disconnection.
- Repeat until successful.
Automated Resource Count Reduction
Use the aws_account_delete script from the Guardrails Samples repository. It automates CMDB policy creation and account disconnection. See the README for setup instructions.
How Disconnection Works
Guardrails removes the account, all child resources, controls, and policy settings in a single SQL transaction. If the transaction exceeds the statement timeout (due to a large resource count), it rolls back safely and the account remains visible. Reduce the resource count and retry.
If the account cannot be disconnected after multiple attempts, Open a Support Ticket.