Skip to Content

Identity & Access

Who can do what in AWS, from a single IAM user to hundreds of accounts and millions of app users.

What it is

Every request to AWS answers two questions:

  1. Who is making the request? This is authentication: proving an identity with a password, MFA code, access key or token.
  2. What is that identity allowed to do? This is authorization: checking its permissions for this action on this resource.

AWS Identity and Access Management (IAM) answers both for one AWS account. It's a global service (there's no Region to pick) and it's free: billing covers only the resources the users create.

As a company grows, one account isn't enough. The rest of this group covers the services that manage identity across many accounts (Organizations, Control Tower, IAM Identity Center), connect to a company directory (Directory Service), share resources between accounts (RAM), and sign in the users of a company's own apps (Cognito).

The building blocks of IAM

  • Root user: the identity created with the account, signed in with the account's email address. It can do everything, so it is locked away and used only for the few tasks that need it.
  • IAM users: long-term identities for people or, rarely, applications. Each has its own password for the console and, if needed, access keys for the CLI.
  • IAM groups: collections of users. Permissions given to a group apply to every user in it. Groups contain only users, never other groups.
  • IAM roles: identities with no long-term credentials. Users, applications and AWS services assume a role to get temporary credentials.
  • Policies: JSON documents that say which actions are allowed or denied on which resources. They're attached to users, groups and roles, or to resources such as S3 buckets.

Example

A small company has five developers and two operations engineers. It creates a Developers group and an Operations group, attaches a policy to each, and adds every person as a user in the right group. When someone joins, they're added to a group and get the right access at once. When they leave, their user is deleted. Applications on EC2 don't get users at all: they use a role.

In this group

IAM basics

Advanced IAM

Many accounts

App users

Which service for which identity?

  • People in the company, one account → IAM users and groups (or IAM Identity Center).
  • People in the company, many accounts → IAM Identity Center with AWS Organizations.
  • The company already uses Microsoft Active Directory → connect it with AWS Directory Service and IAM Identity Center.
  • An application running on AWS (EC2, Lambda, ECS) → an IAM role.
  • Another AWS account → a cross-account IAM role, or a resource-based policy.
  • Customers using a web or mobile app (thousands or millions of them) → Amazon Cognito.

Exam tips

  • "Global service", "not tied to a Region" → IAM (so are Organizations, Route 53 and CloudFront).
  • "Grant an EC2 instance or Lambda function access to S3 / DynamoDB" → an IAM role, never access keys.
  • "Many accounts", "central management", "consolidated billing" → AWS Organizations.
  • "Single sign-on for employees across accounts" → IAM Identity Center.
  • "Hundreds of thousands of users", "mobile app users", "sign in with Google / Facebook" → Amazon Cognito, not IAM.

Common traps

  • Creating IAM users for app customers. IAM is for people and workloads that manage AWS. App customers belong in Cognito.
  • Using the root user for daily work. Root is for a short list of account-level tasks only.
  • Putting groups inside groups. IAM groups can't be nested.

AWS documentation

On this page

Open notes

Spotted a mistake?

These notes are open source. Suggest a fix, or star the repo if they helped you.

Suggest an edit

For AI agents: llms.txt · llms-full.txt