Least-Privilege IAM on AWS

Bring an over-permissioned serverless payroll workload on AWS down to least privilege without breaking it: record what each role really does, test reviewed policies with the IAM policy simulator before applying them, tighten one role at a time with an alarm and a one-step rollback, delegate role creation behind a permissions boundary, preview external access, block wider permissions at review time and hand over the evidence.

Cloud Security Engineer. Advanced.

What you will build and explain

  • Explain why any AWS call is allowed or denied by walking the policy evaluation logic: explicit denies, service control policies, identity and resource policies, and permissions boundaries.
  • Measure what each role really uses with CloudTrail data events, IAM Access Analyzer policy generation and last-accessed data, and say what each source misses.
  • Turn recorded activity into reviewed, right-sized policies and prove them with required and forbidden permission tests, including the rarely run month-end and error paths.
  • Change live permissions one role at a time, detect an access denial within minutes and roll it back in one step, then reconcile the code with the account.
  • Delegate role creation behind a permissions boundary, show that escalation attempts fail, check external access before granting it, and stop wider permissions at review time.

Before you begin

  • Terminal use, Git commits and diffs, and editing JSON and YAML; no Terraform experience needed, it is taught from the start
  • Reading short Python functions: variables, dictionaries, if statements, loops and exceptions (no code is written from scratch)
  • Linux x86-64 with Docker for the local checks; an AWS account in which you may create IAM roles, a spending limit and a time window for the deployment

Curriculum

Learning topics (19)
  1. Understand the brief and prepare a lab that cannot touch anything else

    This project changes permissions, and permissions are shared by everything in an AWS account. A mistake here does not stay in one application: a policy attached to the wrong role, or a trail created over someone else's, affects every team in the account. So before any IAM lesson, this page covers four things. It says what you should already know and what the project teaches. It covers the small amount of AWS you need before the first deployment: accounts, Regions, organisatio

  2. Map the payroll workload and every identity in it

    This project takes a small payroll workload whose permissions are far too broad and brings it down to least privilege without breaking it. Least privilege means each identity can do what its job needs and nothing more.

  3. Describe, plan and apply infrastructure with Terraform

    Objective. By the end of this lesson you can read this project's Terraform files, predict what plan will show, and explain where each layer keeps its record of what it created. You also know which layer runs as which identity. You need only the prerequisites: a terminal, JSON and the idea of an AWS account and Region.

  4. Read principals, roles and the policy language

    Objective. Read any policy in this project and say, statement by statement, who it applies to, what it allows and on which resources. Then compare the shared role's starting policy with a function's target policy and name every difference. You need the prerequisites, in particular reading an ARN.

  5. Work out why a call is allowed or denied

    Objective. Given a denied call, say which kind of denial it was and which policy caused it, before changing anything. This is the skill behind every milestone of the deployment: the trap in milestone 7, the boundary in milestone 9 and the bucket fence all come down to this evaluation. You need lesson 4: statements, actions, resources and conditions.

  6. Decide who may take on a role

    Objective. For each role in the lab, say who may become it, under which conditions, and how you would prove that nobody else can. You also learn why handing a role to a service, with iam:PassRole, is as sensitive as granting the role's permissions directly. You need lesson 4, where a role's trust policy and permissions policies were introduced, and lesson 5 for how conditions are evaluated.

  7. Record what each role really does, and what the records miss

    Objective. Read the evidence of what a role actually did, from three different sources, and say for each what it cannot show. This is the evidence behind milestone 6, and the reason milestone 7's trap works. You need lesson 4 for actions and resources, and lesson 6 for role sessions.

  8. Turn recorded activity into a reviewed policy

    Objective. Take a generated draft and turn it into a policy you would approve: exact actions, exact resources, the paths no record shows, and nothing else. You also see why a draft applied without that review is the trap of milestone 7. You need lesson 7: what each record shows and misses.

  9. Test permissions before changing them

    Objective. Write down what a role must and must not be able to do, then prove a policy meets both lists before it is applied, and again after. By the end you can read a permission-test result row by row, and know what the IAM policy simulator does not see. You need lesson 5 for the evaluation order and lesson 8 for where candidate policies come from.

  10. Tighten one role at a time and undo a mistake in one step

    Objective. Change a production role's permissions in steps small enough to diagnose, notice a mistake within minutes, and undo it in seconds without a deployment. Then make the code agree with the account again. You need lesson 4 for managed policy versions and lesson 9 for the tests that come before each step.

  11. Let a team create roles without letting it become administrator

    Objective. Give the application team the right to create and change its own roles, and prove it cannot use that right to give itself more access than the security team intended. You need lesson 5 for how a boundary takes part in the evaluation, and lesson 6 for iam:PassRole.

  12. Check who can get in from outside before granting it

    Objective. Find out which resources can be reached from outside the account, and what a proposed grant would allow, before you make it. You also learn what an external ID does, and what it does not. You need lesson 5 for the cross-account rule and lesson 6 for trust policies and the confused deputy.

  13. Stop wider permissions at review time

    Objective. Make a change that widens a role fail before it is applied, with a finding a reviewer can read, and know which checks run without AWS and which need it. You need lesson 3 for plans, lesson 9 for what tests cover, and lesson 12 for public and cross-account access.

  14. Manage IAM in two Terraform layers

    Objective. Read the Terraform that creates every role and policy in the lab, and explain the choices that make IAM safe to manage as code. These are: policies kept as reviewable files, roles created from a list, names known before apply, and protection against changes that would replace an attached policy. You need lesson 3 for blocks, state and plans, and lesson 11 for why there are two layers.

  15. Report the evidence, the cost and the cleanup

    Objective. Hand over the three things a client or auditor asks for at the end of an engagement: evidence of what changed and how it was proved, what it cost, and proof that nothing was left behind. You need the earlier lessons; this one draws on all of them.

  16. Deploy and tighten the lab on AWS

    This guide deploys Quillfield Payroll's workload in its over-permissioned starting state, then takes it to least privilege on AWS, one milestone at a time. You record what each role does, test a policy built from those records and see it fail, apply it anyway and roll it back. You move each function to its own role, delegate role creation behind a boundary and check who could get in from outside. Finally you block a wider policy at review time and build the evidence report. C

  17. Diagnose access problems

    Almost every problem in this project shows up as a call that was allowed when it should not have been, or denied when it should not have been. The first useful questions are always the same: which call, by which principal, on which resource, and which policy decided? The project is built so you can answer them for any single call, and the scenarios practise doing it.

  18. Prepare for cloud security interviews

    Building the project is half of being able to talk about it. The other half is explaining why each control is there, what it costs and what it does not protect against, to someone who will push on every claim. The question list is organised by topic: the engagement and its architecture, policies and evaluation, right-sizing safely, delegation and external access, and delivery, evidence and cost.

  19. Remove the lab and check for leftovers

    Everything the lab creates belongs to one of three Terraform layers, and each layer is removed by destroying it. Some steps must happen first, because AWS will not delete a bucket that still holds objects, and a trail keeps adding objects to its bucket until it stops. This page works at any point: after milestone 12, half-way through, or after a failed apply. It also works after the approved window has ended, because the guard always allows cleanup.

Practical build steps (10)
  1. Prepare the tools, sign-in and inputs

    Before anything is created, three questions need firm answers: does the code work, which account and Region will it run in, and who is allowed to act there? The local checks answer the first without an account. The input file, the guard and the preflight answer the other two, and the guard keeps answering them before every later change.

  2. Create the state bucket and the platform

    This is the first change to your account, and the first time Terraform changes anything in it. You apply two layers: the bootstrap, which creates one bucket to keep Terraform's state, and the platform, which the security team owns. The platform holds the boundary, the deployer role, Access Analyzer's service role, the trail, the analyzer and the alarms.

  3. Deploy the workload and run the daily path

    Now you switch teams. The workload layer is applied as the deployer role, not as the operator, so every call Terraform makes is limited to what the application team may do. Then you run two months of daily payroll, the only work the recording window should contain.

  4. Read what the starting role did

    The trail has recorded every call the shared role made. In this milestone you read that record three ways and test the role's policy with the IAM policy simulator. The result is a clear picture of the excess, and a first look at what the records cannot show.

  5. Apply a daily-only draft, catch it and roll back

    This milestone breaks payroll on purpose. A policy built from daily records alone looks complete, and the daily path still works with it. The permission tests say otherwise, and you apply it anyway, so that the safety net has something real to catch.

  6. Move each function to its own role

    With the safety net proved, you replace the shared role, one function at a time. Each function gets its own role and a policy that lists exact actions on exact resources. After each change you run every path, the rare ones included, before moving on.

  7. Delegate role creation behind the boundary

    The application team creates its own roles, which is convenient and, in the starting state, dangerous. A deployer that can create a role and attach any policy to it can give itself more access than it was ever granted. This milestone closes that path and then tries to break through it seven different ways.

  8. Check who can get in

    Least privilege also covers who can get in from outside. An audit firm wants to read the month-end reports. Before anything is granted, you ask IAM Access Analyzer what its proposal would allow, in a correct version and a flawed one.

  9. Run the review gate and build the evidence

    Everything so far was checked by hand, one milestone at a time. The review gate makes the important checks automatic: before a change to the workload layer is applied, IAM Access Analyzer checks the planned policies. Then the evidence report gathers everything the lab saved into one document for an auditor.

  10. Remove the lab and check for leftovers

    Cleanup removes all three layers, top-down: workload, then platform, then the state bucket. It then checks that nothing of the lab remains and that the account-wide items are as they were. Use it after the last milestone, or at any point when you need to stop.

Access

Learning Access: INR 199 plus 18% GST. Source Pack: INR 399 plus 18% GST. 90 days of online access. No auto-renewal.

Cloud costs and boundaries

AWS usage is separate from project access. A deployment and verification session is estimated at about 10 US cents at list prices, mostly the review gate's paid IAM Access Analyzer checks; if the account already has a CloudTrail trail, the lab trail's copy of management events adds a little. Left deployed and idle, the lab costs well under a US dollar a month, mostly alarms and queue polling, until the cleanup procedure removes it. The local checks cost nothing. This is a learning reference, not a hosted lab or a production-readiness guarantee.

Licence and completion

Vectametric Project Source Licence (2026-09-27): lawfully obtained source may be copied, modified and deployed for personal learning and interview preparation, including personal portfolio demonstrations with attribution. These permissions continue after online access expires. Do not resell or redistribute the Source Pack or its original source files, unchanged or modified. Commercial or client production use requires separate written permission. Third-party components, such as boto3, moto, pytest, ruff, Checkov, tf-policy-validator, Terraform, Trivy and the Terraform providers, retain their own licences. See LICENSE.txt and the Project Source Licence section of the site Terms for the full rules.

Questions about projects

Do I need a cloud account?

You can read the project material without deploying it. Running a cloud build requires the accounts, permissions and tools listed in that project's prerequisites. Deployment runs in your environment, not in a hosted Vectametric lab.

Can I read the code with Learning Access?

Yes. Learning Access includes the online source-file browser and explanations. The Source Pack adds the downloadable reference repository where available. The project's licence governs use of the source.

Are cloud charges included?

No. Cloud and CI usage are separate. Read the project's cost notice, set a budget and stop deadline, and follow its destruction and leftover-resource checks.

Does the project include troubleshooting and interview preparation?

The project curriculum lists the available scenarios and interview topics. These focus on understanding the architecture and explaining decisions; they are not a promise of particular interview questions or a job.

How long can I use the project?

The project page and checkout show the online access period for your selected plan. Access does not auto-renew. Downloaded source remains subject to its licence; future releases are not automatically included.

Review the Terms and No-Refund Policy before confirming access. All sales are final; Vectametric does not offer refunds.

This website is operated by VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED, operating as Vectametric.

Corporate Identity Number (CIN): U85499KA2026OPC229822. GSTIN: 29AAMCV8281D1ZS. Registered office: RS NO/38/2A/1 BASTAND, ROAD MAHANTESH NAGAR, Ramdurg, Ramdurg, Belgaum- 591123, Karnataka.

Queries and grievances: Prajval Honnungar, Grievance Officer and Data Protection Contact.

Telephone: +91 94800 09310. Support: support@vectametric.com. Grievances: support@vectametric.com.

Copyright 2026 VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED. All rights reserved.

Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy