How to rename an AWS customer IAM policy?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
AWS does not support renaming an existing customer managed IAM policy in place. In practice, "renaming" a policy means creating a new policy with the same document under the new name, attaching it wherever the old one was used, and then deleting the old policy when it is no longer attached.
Why There Is No Rename Operation
An IAM policy is identified by its ARN, and the policy name is part of that identity. AWS lets you edit the policy document by creating new versions, but that changes permissions, not the policy's name or ARN.
That distinction matters operationally:
- changing a policy version keeps the same policy identity
- changing the name requires a new policy resource
- anything referring to the old policy ARN must be updated
So the safe mental model is that a rename is really a controlled replacement.
Step 1: Export the Existing Policy Document
First, identify the current default version of the policy and fetch its JSON document.
Then fetch the default version itself.
In a real account, replace v1 with the DefaultVersionId returned by get-policy.
If the policy uses tags or a useful description, capture those too so the replacement is complete rather than just permission-equivalent.
Step 2: Create the New Policy
Once you have the JSON document, create a new customer managed policy with the desired name.
This creates a new ARN. From this point on, you have two separate policies in your account even if their JSON is identical.
Step 3: Find Every Attachment of the Old Policy
Before detaching anything, discover where the old policy is currently attached.
That output tells you which users, groups, and roles currently depend on the old policy. This step is critical, because forgetting one attachment is the easiest way to cause an unexpected authorization failure after cleanup.
Step 4: Attach the New Policy Everywhere
Now attach the new policy to the same principals.
If the old policy was attached to groups, use attach-group-policy as well.
A careful migration sequence is:
- attach the new policy first
- verify access still works
- only then detach the old policy
That prevents accidental permission gaps.
Step 5: Detach and Delete the Old Policy
After you confirm the replacement is attached everywhere, remove the old one.
Once the old policy has no more attachments and no dependent policy versions to worry about, delete it.
AWS will reject the delete if the policy is still attached.
Policy Versions Are Not Renames
A common misunderstanding is thinking you can solve this by creating a new policy version and setting it as default. That is useful when permissions need to change, but it does not rename the policy.
The policy ARN, policy name, and every reference to that identity remain exactly the same.
So if your goal is cleaner naming, environment standardization, or migration to a new naming convention, you need a new policy resource.
Common Pitfalls
The biggest mistake is deleting the old policy before confirming every user, group, and role has the new one attached.
Another mistake is preserving only the JSON document but forgetting metadata such as tags, descriptions, or documentation references tied to the old policy.
A third issue is overlooking code and infrastructure that refer to the old policy ARN explicitly. CloudFormation templates, Terraform variables, and internal deployment scripts may need updates even after the IAM attachments are fixed.
Finally, do not confuse customer managed policies with inline policies. Inline policies do not have the same rename workflow because they are embedded directly in a principal.
Summary
- AWS does not support renaming a customer managed IAM policy in place.
- A rename is implemented as create new, attach new, detach old, delete old.
- Export the current default policy version before changing anything.
- Use
list-entities-for-policyto find every attachment of the old policy. - Attach the new policy before detaching the old one to avoid outages.
- Update any hard-coded references to the old policy ARN as part of the migration.
Related reading
- How to rename AWS S3 Bucket
- How to rename files and folder in Amazon S3?
- How to resolve The maximum number of addresses has been reached for AWS VPC Elastic IP addresses?
- How to resolve 'Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment
- How to restart containers in AWS ECS?
- How to restore folders or entire buckets to Amazon S3 from Glacier?
- How to restrict the size of the file being uploaded on to the AWS S3 service using presigned urls
- How to retrieve a secret in terraform from aws secret manager

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.