ERROR REFERENCE
An IAM role reached its managed-policy attachment quota
Cannot exceed quota for PoliciesPerRole: 10
IAM rejected attaching another managed policy to a role. The quoted
number is the account's applied PoliciesPerRole quota and
can vary; it is adjustable, unlike the hard inline-policy document-size
limit.
WHAT IT MEANS
What this error means
An error occurred (LimitExceeded) when calling the AttachRolePolicy operation:
Cannot exceed quota for PoliciesPerRole: 10
CREATE_FAILED AWS::IAM::Role MyRole Resource handler returned message:
"Cannot exceed quota for PoliciesPerRole: 10 (Service: Iam, Status Code: 409)"
(HandlerErrorCode: ServiceLimitExceeded)
Attaching one more managed policy would take the role past its allowance. This is the attachment-count limit, not the document-size limit for a single policy and not the aggregate inline-policy size limit.
SAFE NEXT STEPS
Confirm the role and account before changing permissions
-
Name the role and its current attachments.
aws iam list-attached-role-policies --role-name YOUR_ROLE -
Confirm the applied quota.
aws iam get-account-summary --query "SummaryMap.AttachedPoliciesPerRoleQuota" --output text - Remove an attachment only after confirming it is obsolete. Check who owns each policy before detaching; do not detach policies blindly to make the error go away.
- Consolidate policies deliberately. Merge only when the combined policy stays least-privilege and reviewable. Do not broaden actions or resources just to lower the attachment count.
-
When every attachment is intentional, request an increase.
PoliciesPerRoleis an adjustable quota. File the increase through Service Quotas; IAM's quota guide directs these requests through US East (N. Virginia).
AUTOMATE THE TRIAGE
Diagnose this automatically
SAM Doctor recognizes direct IAM attachment failures and matching CloudFormation resource events, keeps unrelated failed resources visible, and runs locally without AWS credentials or log upload.
python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown
RELATED
Related errors
- Maximum policy size of 10240 bytes exceeded for role — the hard aggregate inline-policy limit, separate from the adjustable attachment count.
- CREATE_FAILED / UPDATE_FAILED — the generic CloudFormation handoff when no concrete resource reason is present.