# Error: Error putting IAM policy: LimitExceeded: Cannot exceed quota for PolicySize: 6144

- **ID:** `policy/aws-iam-policy-size-exceeded`
- **Domain:** policy
- **Category:** resource_error
- **Error Code:** `LimitExceeded`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

AWS IAM policy size limit is 6144 characters for customer managed policies; the policy document exceeds this due to too many statements, long ARNs, or verbose conditions.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| AWS IAM API 2010-05-08 | active | — | — |
| AWS CLI v2.15.0 | active | — | — |
| Terraform AWS Provider v5.40.0 | active | — | — |

## Workarounds

1. **Consolidate multiple statements with overlapping actions into a single statement using a list of actions and resources. For example, combine 's3:GetObject' and 's3:PutObject' into one statement with 's3:GetObject', 's3:PutObject'.** (80% success)
   ```
   Consolidate multiple statements with overlapping actions into a single statement using a list of actions and resources. For example, combine 's3:GetObject' and 's3:PutObject' into one statement with 's3:GetObject', 's3:PutObject'.
   ```
2. **Use policy variables like ${aws:username} to reduce hardcoded ARN length, and remove redundant conditions.** (75% success)
   ```
   Use policy variables like ${aws:username} to reduce hardcoded ARN length, and remove redundant conditions.
   ```
3. **Split the policy into multiple managed policies attached to the same role; each managed policy has its own 6144 character limit.** (85% success)
   ```
   Split the policy into multiple managed policies attached to the same role; each managed policy has its own 6144 character limit.
   ```

## Dead Ends

- **** — Removing whitespace or minifying JSON does not reduce the character count significantly; the error is about logical size, not formatting. (90% fail)
- **** — Splitting the policy into multiple inline policies on the same role still counts toward the total role policy size limit (10240 characters). (70% fail)
- **** — Using a wildcard instead of listing individual resources may violate least-privilege policies and still hit size limits if the condition is verbose. (50% fail)
