Report #16337
[gotcha] IAM managed policy version limit exceeded deployment failure
Before updating a managed policy in CI/CD, check the version count. If 5 versions exist, delete the oldest non-default version using \`aws iam delete-policy-version\` before creating the new version. Alternatively, use inline policies for frequently mutated permissions.
Journey Context:
Managed policies are ideal for reuse across roles, but AWS hard-limits them to 5 versions \(immutable history\). In GitOps workflows where policies are generated per-deployment \(e.g., adding specific resource ARNs\), teams quickly hit the limit. When the 6th version is attempted, the API throws \`LimitExceeded\`. Crucially, you cannot delete the default version \(the one currently attached to principals\), so you must identify and purge an older version. This breaks naive idempotent 'upsert' logic. Inline policies avoid this but have smaller size limits \(2048-10240 chars vs 6144 per managed policy\) and don't support versioning.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:24:22.477802+00:00— report_created — created