Identity and Access: IAM, Roles, and Multi-Account Guardrails
Design secure access to AWS resources: IAM users, roles, and policies, how AWS evaluates a request, temporary credentials with STS, IAM Identity Center, and multi-account guardrails with Organizations, SCPs, and Control Tower.
Who Can Do What, to Which Resource
Every AWS API call answers three questions: who is calling (the principal), what they want to do (the action), and to which resource. IAM is how you control the answers.
| Concept | What it is | Use it for |
|---|---|---|
| Root user | The account’s original identity with full, unrestricted access | Almost nothing. Turn on MFA, don’t create access keys, lock it away |
| IAM user | A long-lived identity with a password and/or access keys | Rare today. Prefer federation for people and roles for workloads |
| IAM group | A collection of users that share policies | Managing permissions for many users at once |
| IAM role | An identity with no long-term credentials; anyone allowed to assume it gets temporary credentials | EC2 instances, Lambda functions, cross-account access, federated users |
| Policy | A JSON document of Allow/Deny statements | Granting or limiting permissions |
Roles are the answer to most access questions on the exam. An EC2 instance that needs to read S3 gets an instance profile with a role, never access keys stored on disk. A Lambda function gets an execution role. Another AWS account gets a role it can assume.
Policy types
- Identity-based policies attach to a user, group, or role: “this role can read bucket X.”
- Resource-based policies attach to a resource: an S3 bucket policy, a KMS key policy, an SQS queue policy. They name which principals may act on the resource, including principals in other accounts.
- Permissions boundaries set the maximum permissions an identity-based policy can grant to a user or role. Useful when you let developers create their own roles.
- Service control policies (SCPs) and resource control policies (RCPs) in AWS Organizations set the maximum permissions for every principal or resource in an account.
- Session policies narrow permissions further for a single assumed-role session.
Boundaries, SCPs, RCPs, and session policies never grant anything. They only limit.
How AWS Decides: Allow or Deny
For a request inside a single account, AWS evaluates every policy that applies. The simplified logic:
Three rules to memorize:
- Everything starts denied (implicit deny).
- An explicit Deny anywhere wins, no matter how many Allows exist.
- Cross-account access needs both sides: the caller’s identity policy must allow the action, and the resource policy (or the role trust policy) in the other account must allow the caller.
Temporary Credentials and Federation
AWS Security Token Service (STS) issues short-lived credentials. You meet it through AssumeRole (for roles and cross-account access) and through federation.
- Cross-account access: Account B creates a role whose trust policy names Account A. A principal in Account A with permission to call
sts:AssumeRoleon that role gets temporary credentials for Account B. - Workforce access: IAM Identity Center connects your identity provider (Microsoft Entra ID, Okta, or its own directory) to every account in your organization. People sign in once and pick a permission set for each account. This is the recommended way for humans to reach AWS.
- Application users: Amazon Cognito user pools handle sign-up and sign-in for your app’s customers. Identity pools exchange those identities for temporary AWS credentials, for example to upload directly to S3.
Cross-account access with a role, step by step:
Multi-Account Guardrails
Large organizations use many accounts: separate accounts for production, development, security tooling, logging, and each team. An account is the strongest isolation boundary AWS offers; it limits blast radius, quotas, and billing.
- AWS Organizations groups accounts into organizational units (OUs) with consolidated billing.
- SCPs attached to an OU limit what any principal in those accounts can do. Classic examples: deny actions outside approved Regions, deny disabling CloudTrail, deny leaving the organization. SCPs don’t apply to the management account, so keep workloads out of it.
- AWS Control Tower sets up a well-architected multi-account landing zone for you: a log archive account, an audit account, guardrails (called controls), and Account Factory for creating new accounts that follow the rules.
Common mistake: an exam answer attaches an SCP that “allows S3 access” so developers can use S3.
SCPs only set the ceiling. A developer still needs an identity-based policy that allows S3. If an answer relies on an SCP or a permissions boundary to grant access, it’s wrong.
Key Takeaway
Use roles and temporary credentials for workloads and cross-account access, IAM Identity Center for people, and Cognito for app users. Remember that explicit deny wins, guardrails (SCPs, RCPs, boundaries) only limit, and cross-account access needs an Allow on both sides. Use Organizations, SCPs, and Control Tower to govern many accounts.
In a sandbox account:
- Create an S3 bucket and upload a file.
- Launch a small EC2 instance without a role. Run
aws s3 ls s3://your-bucket. It fails: no credentials. - Create an IAM role for EC2 with a policy allowing
s3:GetObjectands3:ListBucketon only that bucket. Attach it to the instance as an instance profile. Run the command again. It works, and no keys are stored on the instance. - Add an explicit
Denyfors3:GetObjecton one object prefix. Confirm that the deny wins.
If you have an Organizations sandbox, write (don’t attach to production) an SCP that denies all actions outside us-east-1 and us-west-2, with exceptions for global services such as IAM. Clean up when you’re done.
1. An application on EC2 needs to write to a DynamoDB table. What is the MOST secure way to give it access?
An instance profile delivers temporary, automatically rotated credentials. No long-term keys are stored on the instance.
2. An identity policy allows s3:DeleteObject, but an SCP on the account denies it. What happens?
An explicit deny in any applicable policy overrides any allow.
3. A company wants employees to sign in once with their corporate identity provider and access many AWS accounts. Which service fits best?
IAM Identity Center federates your workforce identity provider to all accounts in the organization through permission sets.
4. What do service control policies (SCPs) do?
SCPs are guardrails. They limit permissions but never grant them.