Cloud IAM Least Privilege
Cloud IAM least privilege means every human and workload identity gets only the actions and resources required for its job — nothing more — with MFA for humans, short-lived credentials for machines, and audit logs that prove who did what. Wide *:* admin policies are convenient until one key leaks; Capital One–era lessons still apply.
Friends! Clicking AdministratorAccess in the cloud console and saying "done" — OK for a temporary lab, not a production habit. Least privilege = needed actions + scoped resources + MFA + CloudTrail/activity logs. Today: AWS-style examples for defence; do not experiment in someone else's account. Own account / written authorisation only.
मित्रांनो! Cloud console मध्ये AdministratorAccess click करून "काम झालं" – temporary lab OK, production habit नाही. Least privilege = जरूरी actions + scoped resources + MFA + CloudTrail/activity logs. आज AWS-style examples defence साठी; दुसऱ्या account मध्ये experiment नको. Own account / written authorisation only.
मित्रों! Cloud console में AdministratorAccess click करके "काम हो गया" – temporary lab OK, production habit नहीं. Least privilege = ज़रूरी actions + scoped resources + MFA + CloudTrail/activity logs. आज AWS-style examples defence के लिए; दूसरे account में experiment नहीं. Own account / written authorisation only.
Quick answer
Cloud IAM least privilege checklist:
- Separate human users from workload roles (EC2 / Lambda / Kubernetes service accounts).
- Prefer roles + temporary credentials over long-lived access keys.
- Start deny-by-default; add only needed
ActionandResourceARNs. - Enforce MFA on humans; block root for daily work.
- Turn on cloud audit logs (CloudTrail / equivalent) and alert on IAM changes.
- Review unused permissions and stale keys quarterly.
- Break-glass admin account: monitored, MFA, rare use, ticketed.
Tiny mental model:
Identity → Authentication (MFA) → Authorisation (least privilege) → Audit
*:* admin = blast radius = entire account
Keys in git = incident waiting
What do I need before this guide?
- Optional AWS IAM MFA guide: Create IAM user with MFA.
- Optional: Attach IAM role to EC2.
- Basic idea of cloud shared responsibility.
What does least privilege look like?
Wide admin access is risky. Least privilege grants only needed actions, with MFA and cloud audit logs.
Wide admin access risky आहे. Least privilege फक्त needed actions देते, MFA आणि cloud audit logs सोबत.
Wide admin access risky है. Least privilege सिर्फ needed actions देता है, MFA और cloud audit logs के साथ.
- Identity — who (user, role, service principal).
- Authentication — prove it (password + MFA, federation, workload identity).
- Authorisation — allowlist of actions on specific resources.
- Boundary / SCP / org policy — guardrails even administrators struggle to bypass casually.
- Audit — immutable-ish logs of API calls and console sign-ins.
Educational warning: practise IAM tightens in accounts you own. Do not “test deny policies” on a shared company prod account without change control — you can lock teams out.
Real incident: Capital One (2019) — cloud identity and misconfiguration themes
Public reporting on the Capital One 2019 breach described a misconfigured web application firewall / SSRF-style path leading to abuse of cloud metadata credentials and broad data access themes. The lasting blue-team lesson: instance roles and metadata, over-permissive IAM, and detection of unusual cloud API usage must be first-class controls — not afterthoughts.
Takeaways (vertical):
- What happened — cloud-hosted data exposure with identity/credential pathways in public analyses.
- What went wrong (theme) — excessive role permissions and insufficient guardrails around metadata / SSRF classes of bugs.
- Care-take — scope instance roles to exact S3 prefixes / APIs needed.
- Care-take — monitor CloudTrail for strange
s3:List/ credential-like patterns from web tiers. - Care-take — IMDSv2-style hardening themes reduce casual metadata theft (follow current AWS guidance).
- Bonus parallel — countless breaches start with a leaked AKIA… key pushed to a public repo.
Humans vs workloads (do not mix)
- Humans: SSO + MFA + time-bound elevation for admin tasks.
- Workloads: roles assumed by compute — no shared “deploy user” password.
- Contractors: separate accounts or permission sets; expiry dates on access.
- Automation: prefer OIDC from GitHub Actions / GitLab to cloud roles over static keys.
- If you must use keys: minimum actions, short rotation, never on developer laptops long-term.
Red Team vs Blue Team (awareness only)
Red Team — what attackers try
- Phish console passwords; bypass MFA fatigue where possible.
- Steal long-lived keys from CI logs, images, chat pastes.
- Abuse over-broad roles reachable from a single web foothold (high-level).
Blue Team — defend, detect, respond
- MFA everywhere humans exist; passkeys where supported.
- Short-lived federation (SSO) over permanent IAM users when possible.
- Permission boundaries; remove unused actions with access analyser-style tools.
- Alert: root login, Disable CloudTrail, AttachUserPolicy of Admin, CreateAccessKey surprises.
- Rotate and delete unused keys; never embed keys in AMIs.
How do I apply least privilege step by step?
Step 1 — Inventory identities
- List human users, groups, roles, service accounts.
- Flag anything with Administrator / Owner equivalents.
- Flag access keys older than your policy (for example 90 days).
Step 2 — Split duties
- Billing ≠ security admin ≠ app deploy roles when the org is large enough.
- Developers get deploy roles to their namespaces / accounts — not org-wide IAM full control.
- CI systems get OIDC federation to cloud roles — not a static key in a variable if you can avoid it.
Step 3 — Write a narrow policy (AWS-shaped example)
Illustrative deny-by-omission idea (not a paste-blind into prod):
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:PutObject"],
"Resource": ["arn:aws:s3:::learnfast-app-uploads/*"]
}]
}
Contrast with "Action":"*","Resource":"*" — that second shape is a lab convenience, not a production lifestyle.
Step 4 — Attach to roles, not forever-users
- EC2 / ECS / Lambda assume a role.
- Humans assume roles via SSO permission sets.
- Document why each Action exists in a one-line comment in the repo that stores IaC.
Step 5 — Detect misuse
- CloudTrail (or Azure Activity / GCP Audit) on and centralised.
- Alerts for policy changes, root usage, unusual regions, mass
ListBuckets. - Correlate with identity provider sign-in risks.
Step 6 — Review cadence
- Quarterly: unused roles, unused actions, stale keys.
- After every incident: shrink the role that hurt you.
- Tabletop: “CI key leaked on GitHub — revoke path in 15 minutes?”
Ravindra Bagale's Tip
💡 Students give EC2 AdministratorAccess because an S3 test failed. Then they learn theory about blank-password apps stealing credentials via metadata. Write the exact Action first, then expand. Access Denied is the teacher; AdministratorAccess is a shortcut. In interviews state a least-privilege example clearly. Never forget!
Ravindra Bagale's Tip – मराठी
💡 Students EC2 ला AdministratorAccess role देतात कारण S3 test fail झाला. मग blank password वाला app metadata through credentials चोरी ची theory शिकतात. आधी exact Action लिहा, मग expand. Access Denied error = teacher, AdministratorAccess = shortcut. Interview मध्ये least privilege example सशब्द सांगा. बिल्कुल विसरू नका!
Ravindra Bagale's Tip – हिंदी
💡 Students EC2 को AdministratorAccess role देते हैं क्योंकि S3 test fail हुआ. फिर blank password वाले app की metadata से credentials चोरी की theory सीखते हैं. पहले exact Action लिखो, फिर expand. Access Denied error = teacher, AdministratorAccess = shortcut. Interview में least privilege example साफ़ बताओ. बिल्कुल मत भूलो!
Care-take — habits that shrink blast radius
- No root API keys; root MFA; root in a sealed process.
- SCP / org policies block leaving org, disabling security services (where available).
- Secrets in a manager — not in userdata plaintext.
- Separate prod / non-prod accounts.
- Break-glass with alarms.
- When an employee leaves: SSO disable first, then cloud keys.
How do I fix common IAM mistakes?
Ghabru naka 😅 — these are the usual ones:
| Symptom | Likely cause | Fix |
|---|---|---|
| “AccessDenied” loops | Missing Action or wrong Resource ARN | Read the error’s needed action; scope narrowly |
| Keys in GitHub alert | Long-lived key committed | Rotate/delete immediately; switch to roles |
| Everyone is Admin | Convenience culture | Permission sets by job; time-bound elevation |
| Orphan roles | Leavers / old projects | Quarterly cleanup job |
| No idea who changed IAM | Logging off / not watched | CloudTrail + alerts + ticket link |
| Locked out of account | Over-tight without break-glass | Maintain monitored emergency path |
Try it at home
In an AWS free-tier practice account you own (or local IaC plan):
- Create a role that can read one bucket prefix only; prove AccessDenied on another.
- Enable MFA on your IAM user (guide).
- List access keys; delete any you do not need.
- Write three CloudTrail alert ideas (root login, PutBucketPolicy, CreateAccessKey).
- Never paste real secret keys into chat or tickets.
Learn it properly
Course lessons:
- The shared responsibility model
- IAM done right
- Protecting data — S3, encryption and secrets
- Detection — CloudTrail, GuardDuty, Config
- EC2 metadata, SSRF and a leaked key incident
Related guides: IAM user with MFA · Attach IAM role to EC2 · Zero Trust simply · Data breach response
Got it? Least privilege = only needed actions + scoped resources + MFA + audit. Admin convenience in production is costly. Capital One-era lesson: take role scope and metadata paths seriously. No keys in git. Next: learn AI security — prompt injection / data leakage defence.
समजलं का? Least privilege = फक्त जरूरी actions + scoped resources + MFA + audit. : admin convenience production मध्ये costly. Capital One-era lesson: role scope आणि metadata paths serious घ्या. Keys git मध्ये नको. आता AI security — prompt injection / data leakage defence — शिका.
समझ में आया? Least privilege = सिर्फ ज़रूरी actions + scoped resources + MFA + audit. : admin convenience production में costly. Capital One-era lesson: role scope और metadata paths serious लो. Keys git में नहीं. आगे AI security — prompt injection / data leakage defence — सीखो.
Frequently asked questions
What is least privilege?
Granting only the permissions required for a job — nothing more — and reviewing them over time.
Why avoid long-lived access keys?
They leak via git, images and chat; roles with temporary credentials shrink that risk.
Is AdministratorAccess OK in a lab?
For short personal learning maybe; never as a production lifestyle.
What should I alert on first?
Root logins, disabling audit logging, attaching admin policies and surprise access-key creation.
How does Capital One relate?
Public analyses emphasised cloud identity, metadata and over-broad permissions themes — least privilege and monitoring matter.
Where are deeper lessons?
Cyber Part 11 cloud and AWS security — IAM done right and related detection lessons.