Quick revision
The short answer
I would set a few firm principles, no long-lived keys for workloads, CI or people, least privilege, and an owner for every role, and enforce them with organization guardrails: service control policies, permission boundaries for roles teams create, and IAM Access Analyzer for external and unused access. Roles come from reviewed infrastructure-as-code templates with automated policy checks, a map of service to role to data store is built from IAM and CloudTrail data, and the change runs in phases with metrics such as keys removed and wildcard policies reduced, funded by a small platform security team rather than left to 300 teams.
What to remember
In this answer, we set IAM governance as principles, no long-lived keys, least privilege and an owner per role, enforced through SCPs, permission boundaries and Access Analyzer. Role templates in infrastructure as code with pipeline checks make the right policy the easy one, a service to role to data map built from IAM and CloudTrail gives visibility, and the work runs in risk-ordered phases with metrics and a funded platform security team.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would set a few firm principles, no long-lived keys for workloads, CI or people, least privilege, and an owner for every role, and enforce them with organization guardrails: service control policies, permission boundaries for roles teams create, and IAM Access Analyzer for external and unused access. Roles come from reviewed infrastructure-as-code templates with automated policy checks, a map of service to role to data store is built from IAM and CloudTrail data, and the change runs in phases with metrics such as keys removed and wildcard policies reduced, funded by a small platform security team rather than left to 300 teams.
Why this question is asked
The findings in this review are typical of a company that grew fast: broad policies written to unblock a deadline, keys created for a CI server years ago, developers with personal keys on laptops, and no picture of who can reach which data. Fixing it is not one project but a multi-year change in how roles are created and reviewed. Interviewers ask this at the senior leadership level to see whether we can set direction, sequence the work so it lands, and keep it from regressing. In this answer, we will set the principles, build the guardrails, make good roles the easy path, get visibility of access, and plan the phases with metrics and funding.
1Principles That Everyone Can Remember
Governance works when a few rules are simple enough that every engineer knows them. We would set three. No long-lived keys: workloads use IAM roles, CI systems use OIDC federation, where the CI provider issues a signed token per job and AWS exchanges it for temporary role credentials, and people sign in through IAM Identity Center with short sessions. Least privilege: each role grants the actions and resources its service needs. And every role has an owner, a team recorded as a tag, who answers for it.
The reason for starting with keys is risk. A long-lived key in a CI system or on a laptop can be copied and used from anywhere until someone notices, while temporary credentials expire within hours and are bound to a workload.
2Guardrails at the Organization Level
With 40 accounts we cannot review every policy by hand, so we use AWS Organizations features that apply to all accounts at once. Service control policies set the maximum any principal in an account can do, for example denying iam:CreateAccessKey for anyone except a break-glass role, denying the disabling of CloudTrail, and restricting regions. Permission boundaries let teams create their own roles, which keeps them fast, while capping what those roles can ever be granted, so a team cannot create a role with more power than the boundary allows.
IAM Access Analyzer finds resources shared outside the organization, such as a bucket policy open to another account, and reports unused access: roles, keys and permissions not used for a period. Those findings become a queue that the platform security team and owners work through.
- Principlesno long-lived keys, least privilege, an owner per role
- Organization guardrailsSCPs, permission boundaries
- Templates in infrastructure as coderole per service, reviewed like code
- Pipeline checkspolicy linting, no wildcards on data
- DetectionAccess Analyzer,
CloudTrail, access map - Regular reviewhigh-risk access, exceptions with end dates
6 layers, from the top down. Step through them one at a time.
Each layer catches what the one above it misses.
3Making the Right Role the Easy Path
Most broad policies exist because writing a narrow one was hard and a deadline was close. So the platform team provides role templates as infrastructure-as-code modules: a Java service declares which buckets, tables and queues it uses, and the module generates a role with exactly those actions, the permission boundary and the owner tag. Policies go through pull requests like code, and the pipeline runs automated checks, such as IAM Access Analyzer policy validation and a rule that rejects Action * or Resource * on data services unless an exception is approved.
4Knowing Who Can Reach Which Data
The review's hardest finding is that nobody can say which service reaches which data. We build that map from data we already have. IAM gives us which role may access which resources; CloudTrail, including data events for sensitive buckets and tables, tells us which role actually did; and tags tell us which service and team own the role and which data stores hold sensitive data. Joined together, that is a graph from service to role to data store, refreshed daily.
With the map, we review high-risk access on a schedule, for example every quarter for anything that can read personal or payment data, and we can answer audit questions in minutes. It also shows where permissions are granted but never used, which feeds the cleanup.
5Phasing the Change and Funding It
We cannot fix 300 services at once, so we sequence by risk. Phase one removes the most dangerous items: CI keys replaced with OIDC federation, laptop keys replaced with Identity Center, and SCPs that stop new keys being created. Phase two introduces templates and boundaries for all new roles and migrates the services with access to sensitive data. Phase three works through the remaining roles using Access Analyzer's unused-access findings, and turns on the pipeline checks as blocking.
Each phase has metrics on a dashboard: the number of active long-lived keys, the number of policies with wildcards on data services, the share of roles with owners, and the time to remove a flagged permission. And we fund a small platform security team, perhaps three to five engineers, to build the templates, run the analysis and help teams. Asking 300 teams to each learn IAM deeply produces 300 different results.
| Phase | Main work | Metric |
|---|---|---|
| 1: stop the bleeding | CI to OIDC, laptops to Identity Center, SCPs | active long-lived keys -> 0 |
| 2: good defaults | templates, boundaries, sensitive services first | roles from templates, owners |
| 3: least privilege | unused access cleanup, blocking checks | wildcard policies on data |
| Ongoing | quarterly review of high-risk access | time to fix findings |
6Follow-up questions
How do you remove unused permissions without breaking rare jobs?
We look at a long enough window: IAM last-accessed data and Access Analyzer's unused access findings are based on a recent period, while some jobs run quarterly or yearly, so we combine them with CloudTrail history and ask the owners about scheduled jobs. Then we remove in stages: first we generate a narrower policy from observed activity, deploy it in a non-production account, and in production we can add alerts on AccessDenied for that role right after the change. Removals happen through the same pull request process, so a rollback is one revert, and the owner confirms. For yearly jobs, we document the needed permissions next to the job definition.
What do you do with keys that truly cannot be replaced, for example for a third-party SaaS?
They become exceptions with an owner and an end date, scoped to one narrow role, rotated automatically through Secrets Manager, and monitored for use from unexpected IP addresses. Many SaaS providers now support role assumption with an external id, which we prefer whenever available.
Why not let each team manage IAM fully on its own?
Because IAM mistakes in one account can expose data company-wide, and most teams lack the time to become IAM experts. Teams keep autonomy inside boundaries and templates, while guardrails and detection are shared.
7Conclusion
In this answer, we set IAM governance as principles, no long-lived keys, least privilege and an owner per role, enforced through SCPs, permission boundaries and Access Analyzer. Role templates in infrastructure as code with pipeline checks make the right policy the easy one, a service to role to data map built from IAM and CloudTrail gives visibility, and the work runs in risk-ordered phases with metrics and a funded platform security team.
Open with
I would start by setting three principles that everyone can remember: no long-lived keys, least privilege, and an owner for every role. For keys that means workloads use IAM roles, CI systems use OIDC federation so each job gets temporary credentials, and people use IAM Identity Center instead of personal keys.
Then, if they want more
Then I would enforce it at the organization level, because with 40 accounts manual review does not scale. Service control policies stop anyone outside a break-glass role from creating access keys or disabling CloudTrail, permission boundaries let teams create their own roles without exceeding a cap, and IAM Access Analyzer finds external sharing and unused permissions.
To make good roles the easy path, the platform team provides infrastructure-as-code templates: a service declares the buckets, tables and queues it uses and gets a narrow role, reviewed in pull requests, with pipeline checks that reject wildcards on data services.
For the visibility problem, I would build a map of service to role to data store from IAM policies, CloudTrail data events and tags, and review access to sensitive data every quarter.
The rollout goes in phases by risk: first remove CI and laptop keys and block new ones, then templates and boundaries for new roles and sensitive services, then clean up unused permissions carefully.
I would track keys remaining, wildcard policies and owned roles on a dashboard, and fund a small platform security team to do the heavy lifting rather than expecting 300 teams to become IAM experts.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- AWS documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Your company runs about 300 Java services across 40 AWS accounts. A security review...": https://scrivio-interview-library.netlify.app/spring-boot/aws/86d855dca8/