Free tech learning for everyone, from basics to pro

AWS SecurityCloud SecurityBeginner

AWS IAM basics: root account, users, groups, roles and least privilege

In short: AWS IAM controls who can do what in your account. Protect the root user with MFA and stop using it day to day, give people access through IAM Identity Center and roles, avoid long-lived access keys, and write policies that grant only the actions and resources really needed.

Why IAM matters most

In the cloud, identity is the new perimeter. Anyone with valid credentials can reach the AWS API from anywhere. Most serious cloud breaches involve stolen keys or over-generous permissions, not clever network attacks. AWS Identity and Access Management (IAM) is therefore the first service to get right.

AWS IAM building blocksIAMwho can do whatRoot userlock awayIAM usersavoid for peopleGroupsbundle usersRolestemporary credsPoliciesJSON permissionsIdentity Centerworkforce SSO
Figure 1. The main IAM components; people should sign in through IAM Identity Center and use roles rather than long-lived keys.

Protect the root user

The root user is the email address that created the account. It can do everything, including closing the account, and policies cannot restrict it inside its own account.

  1. Turn on multi-factor authentication (MFA), ideally a hardware security key.
  2. Delete any root access keys.
  3. Use a shared, monitored mailbox for the root email, not one person's inbox.
  4. Create an administrative identity for daily work and stop using root.
  5. Alert on any root sign-in using CloudTrail.

In AWS Organizations you can also centrally manage root access for member accounts, removing their root credentials entirely.

Users, groups, roles and policies

ComponentWhat it isGood practice
IAM userLong-term identity with password and/or access keysAvoid for people; use only where nothing else works
GroupCollection of users sharing policiesAttach policies to groups, not individuals
RoleIdentity assumed for temporary credentials via AWS STSUse for EC2, Lambda, cross-account and federated access
PolicyJSON document of allowed or denied actions on resourcesGrant specific actions and resource ARNs
IAM Identity CenterSingle sign-on for people across many accountsConnect to your identity provider and use permission sets

A policy that lets a role read one bucket only:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["s3:GetObject", "s3:ListBucket"],
    "Resource": ["arn:aws:s3:::<your-bucket>", "arn:aws:s3:::<your-bucket>/*"]
  }]
}

How permissions are evaluated

How AWS evaluates a requestRequestprincipal,actionExplicitdeny?deny winsSCP /boundarymust allowAllow found?identity orresourceDecisionelse implicitdeny
Figure 2. Simplified policy evaluation: an explicit deny always wins, and anything not explicitly allowed is denied.

Everything starts as denied. An explicit deny anywhere wins over any allow. Guardrails such as service control policies (SCPs) and permissions boundaries set the maximum possible permissions but never grant anything by themselves. The request is allowed only when an identity policy or resource policy allows it and nothing denies it.

Least privilege in practice

  • Start from AWS managed policies for learning, then narrow to custom policies for production.
  • Use IAM Access Analyzer to find resources shared outside your account and to generate policies from real activity.
  • Review last-accessed data and remove permissions nobody uses.
  • Never embed access keys in code or Git; use roles, and rotate any keys that must exist.
  • Add conditions, for example requiring MFA or a specific source network for sensitive actions.

Tip: the IAM and MFA lab walks through securing a new account step by step on your own free-tier account.

Practice

Why should you not use the root user for daily tasks?
It has unrestricted power that policies cannot limit; if its credentials are stolen the whole account is lost.
An EC2 instance needs to read from S3. Should you store an access key on it?
No. Attach an IAM role through an instance profile so it gets short-lived credentials automatically.
A user has an allow for s3:* and an SCP denies s3:DeleteBucket. Can they delete a bucket?
No. An explicit deny in an SCP overrides any allow.

Key takeaways

  • Identity is the main perimeter in the cloud.
  • Lock down root: MFA, no keys, monitored sign-ins.
  • Prefer Identity Center and roles over IAM users and long-lived keys.
  • Explicit deny wins; everything not allowed is denied.
  • Grant specific actions on specific resources and review regularly.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.