Lion Cipher Lab

Write least-privilege AWS IAM policies with Policy Sentry

Why it matters

Almost every serious cloud breach traces back to one identity holding far more permission than it needed. The lazy fix — `"Action": "s3:*", "Resource": "*"` — is exactly how that happens: it works, so nobody tightens it. Writing a genuinely least-privilege policy by hand is miserable, because AWS has thousands of actions and you cannot remember which ones a task needs or which are dangerous (policy edits, `iam:PassRole`). Policy Sentry turns 'least privilege' from a slogan into a file you generate: list your resource ARNs, bucket them by access level, and it prints a tightly-scoped policy.…

What you'll learn

Steps in this lab

  1. When you'd reach for this — author-from-intent vs analyze-what-you-have
  2. Install Policy Sentry (pip, no AWS anything)
  3. Initialize the local IAM database (offline, no credentials)
  4. Look at the enemy first — the lazy wildcard policy
  5. Write the CRUD template — your intent, bucketed by access level
  6. Generate the policy and read what came out
  7. Explore what exists at each access level with `query`
  8. Why resource-scoped ARNs beat wildcards — blast radius and privilege escalation
  9. When NOT to trust it blindly — the limits, and pairing with used-access data
  10. The way a pro does it — start from zero, add what breaks, guard with boundaries

Open the full interactive lab →