You find an IAM policy with `"Action": "*", "Resource": "*"` attached to an application role. How do you right-size it?
BeginnerScenarioCloud IAM and Compliance
Answer
Situation read → The app almost certainly uses a handful of APIs. Find out which ones from real usage, then shrink the policy.
What I'd do →
- Check last-accessed data:
aws iam generate-service-last-accessed-details --arn <role-arn>thenget-service-last-accessed-details. - Use IAM Access Analyzer policy generation from CloudTrail for the role (90 days of activity).
- Write the new policy with specific actions and resource ARNs, e.g.
s3:GetObjectonarn:aws:s3:::orders-bucket/*. - Deploy to staging, watch for
AccessDeniedin CloudTrail, adjust, then roll to prod. - Add a Checkov or cfn-lint rule to block
*:*in future IaC.
Why → Usage data removes the guesswork that keeps teams from tightening policies.
Interview tip → Mention Access Analyzer policy generation by name.
More on Cloud IAM and Compliance
Your 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?BeginnerHow do you collect logs from 40 accounts so an attacker in one account cannot delete them?Intermediate