Module 20 · Cloud Security · Lesson 59 of 75

Identity and access management in the cloud

Users, groups, roles and policies; reading a JSON policy; least privilege, MFA and temporary credentials; and how attackers abuse over-privileged identities.

In this lesson · about 40 minutes

  • Read an IAM policy and explain what it allows
  • Apply least privilege with roles and temporary credentials
  • Recognise common IAM attack paths

Building blocks (AWS names; Azure and GCP are similar)

  • Root account: the all-powerful owner. Lock it with hardware MFA and never use it day to day.
  • Users: people or (avoid this) programs with long-term access keys.
  • Groups: attach permissions to a job role, then add users.
  • Roles: identities that are assumed for a short time, giving temporary credentials. Used by EC2 instances, Lambda functions, other accounts, and people signing in through single sign-on.
  • Policies: JSON documents that allow or deny actions on resources.

Reading a policy

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["s3:GetObject", "s3:PutObject"],
    "Resource": "arn:aws:s3:::shop-invoices/*",
    "Condition": { "Bool": { "aws:MultiFactorAuthPresent": "true" } }
  }]
}

This allows reading and writing objects in one bucket, only when the user signed in with MFA. Rules of evaluation: everything is denied by default, an explicit Allow grants, and an explicit Deny always wins. Organisation-wide guardrails (AWS Service Control Policies, Azure Policy) can deny actions across all accounts.

Dangerous patterns

  • "Action": "*", "Resource": "*": full admin. Often given "temporarily" and never removed.
  • iam:PassRole or iam:CreatePolicyVersion to non-admins: lets them grant themselves more power (privilege escalation).
  • Long-lived access keys in code, laptops or CI systems.
  • Trust policies that let any account assume a role.

Good practice

  1. Single sign-on with MFA for people; no IAM users for humans if you can avoid it.
  2. Roles with temporary credentials for workloads, never embedded keys.
  3. Least privilege: start small, use access analyser tools to trim unused permissions.
  4. Separate accounts or subscriptions for production, development and security logging.
  5. Rotate and alert on any access-key use from unusual places.

Decision scenario

The developer wants admin

You are the cloud security engineer.

A developer's deployment script fails with AccessDenied when uploading build files to the shop-assets bucket. They ask you to give the CI pipeline's role AdministratorAccess "just for today" so the release can go out.

What do you recommend?

0 of 3 options explored. Try the others to see how each would play out.

Check your understanding0 of 4 correct

Question 1

1.If one policy allows an action and another explicitly denies it, the result is...

Question 2

2.What should an EC2 instance use to call AWS APIs?

Question 3

3.Why is iam:PassRole sensitive?

Question 4

4.What protects the root account best?

Quiz score: 0 of 4

Tip: answer every quiz question correctly first.

Written by Noviq Academy in its own words. All labs are simulations: no real systems are touched, and every name, address, password and hash is made up. The offensive techniques taught here are for defending systems and for authorised testing only; never scan, access or test a system without the owner's written permission. Tool and product names belong to their owners, and command output may differ slightly from yours. Read-aloud uses your device's built-in voices.