Service Account Permission Boundaries
What you'll learn: How to use permission boundaries to enforce maximum allowed permissions on service accounts and prevent them from escalating their own privileges.
The Core Problem
Service accounts often need permissions to manage other IAM resources—for example, a CI/CD service account might create deployment roles. Without constraints, this becomes dangerous: a compromised service account could grant itself AdministratorAccess or create new highly-privileged identities.
What Are Permission Boundaries?
A permission boundary is a policy that defines the maximum permissions an identity (including service accounts) can have, regardless of what its identity-based policies grant. Think of it as a ceiling: even if you try to give a service account full admin rights, the boundary prevents those permissions from taking effect.
Effective Permissions = Identity Policy ∩ Permission Boundary
The service account can only use permissions that exist in both its policies and its boundary.
Preventing Privilege Escalation
The key security pattern: when a service account needs to create or modify other IAM identities, attach a permission boundary that:
- Allows only specific, approved actions (e.g., deploying Lambda functions, creating read-only roles)
- Prohibits IAM policy creation beyond a safe scope
- Requires the service account to attach the same boundary to any identities it creates
This creates a "permission inheritance chain" where no descendant identity can exceed the original boundary.
Practical Application
Apply boundaries to automation service accounts, CI/CD pipelines, and any identity with IAM write permissions. Combine with least-privilege identity policies—the boundary is your safety net, not your primary access control.
Key Takeaway: Permission boundaries act as a maximum privilege ceiling for service accounts, preventing privilege escalation even if identity policies are misconfigured or exploited—essential for any service account with IAM management capabilities.