A developer can create IAM roles for their Lambdas. How do you stop them from creating an admin role for themselves?
AdvancedScenarioCloud IAM and Compliance
Answer
Situation read → iam:CreateRole plus iam:PassRole or AttachRolePolicy is a privilege escalation path. Permission boundaries close it.
What I'd do →
- Create a boundary policy defining the maximum any developer-created role can do.
- Allow
iam:CreateRoleonly when the boundary is attached:
"Condition": { "StringEquals": { "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/dev-boundary" } }
- Deny deleting or changing the boundary policy itself and deny
iam:DeleteRolePermissionsBoundary. - Restrict role names to a prefix (
app-*) so they cannot modify platform roles.
Why → Teams self-serve roles, but no role they create can exceed the boundary.
Interview tip → Effective permissions = identity policy ∩ boundary ∩ SCP.
More on Cloud IAM and Compliance
You find an IAM policy with `"Action": "*", "Resource": "*"` attached to an application role. How do you right-size it?BeginnerYour company has 40 AWS accounts with no central controls. How do you set up preventive guardrails?IntermediateGuardDuty reports `UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS`. What happened and what do you do?AdvancedYour company must pass SOC 2 Type II in six months. What does DevOps own, and how do you automate evidence?IntermediateA partner needs access to one S3 bucket in your account. How do you set up cross-account access safely?IntermediateSomeone logged in with the AWS root user last night. How do you react, and how should you have known?Beginner