Clean up unused customer-managed IAM policies to reduce security risk and configuration clutter. This plan walks through discovering all customer-managed IAM policies, identifying those that are completely unattached, collecting rich metadata for review, guiding you through which policies to remove, deleting the approved policies, and finally validating and reporting on what was removed.
In the Assessment Phase, the plan discovers relevant IAM policies and prepares detailed information so you can make informed decisions.
Enumerate customer-managed IAM policies in the account
Collect a complete inventory of customer-managed IAM policies (excluding AWS managed policies). For each policy, record key attributes such as policy name, ARN, default version ID, and any available attachment counts. The results are stored in a structured format (for example, a table or JSON) and checked to ensure the inventory is complete.
Identify customer-managed IAM policies with no attachments
Use the inventory to determine which policies are not attached to any IAM users, roles, or groups. The output is a refined list of policies with zero attachments, including their names, ARNs, and attachment counts, stored in a format ready for deeper metadata collection and user review.
Collect detailed metadata for unattached IAM policies
For each unattached policy, gather full contextual information:
User: Review unattached IAM policies and select policies to delete
Present you with the compiled list of unattached policies, including key metadata (name, ARN, creation date, last updated date, tags, and any last accessed data). You are guided through reviewing these policies, with the ability to inspect full policy documents as needed. You then confirm which specific unattached policies should be deleted, ensuring they are not needed for future use or referenced outside IAM attachments. The outcome is a durable, user-approved deletion list with names and ARNs.
In the Configuration Phase, the plan removes only the policies you have explicitly approved.
The Validation Phase ensures accuracy and produces an auditable record of the cleanup.