AWS Solutions Architect Handbook SAA-C03, from zero Bipin Singh
Security & identity

Roles, federation and identity services

3 min readChapter 06 of 48By Bipin Singh

Most real access on AWS uses temporary credentials: applications assume roles, people sign in through a central identity provider, and app users sign in through Cognito. This chapter covers how those pieces fit together.

AWS STS and assuming roles

The AWS Security Token Service (STS) issues temporary credentials (an access key, secret key and session token that expire — typically after an hour, configurable).

A role has two policies:

  1. Trust policy — who may assume the role (an AWS service, another account, a federated identity provider).
  2. Permissions policy — what the role can do once assumed.
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": { "AWS": "arn:aws:iam::111122223333:root" },
    "Action": "sts:AssumeRole",
    "Condition": { "StringEquals": { "sts:ExternalId": "partner-7731" } }
  }]
}

Common role uses

Scenario How
EC2 app needs AWS access Instance profile with an IAM role
Lambda, ECS tasks, other services Execution / task roles
Engineers switching into another account Role switching (cross-account role)
A third-party vendor accesses your account Cross-account role with an external ID (prevents the "confused deputy" problem)
Users from a corporate directory Federation into roles

Cross-account access: role vs resource policy

Approach How it works When
Cross-account role User in account A assumes a role in account B; acts as account B Broad access to many resources in B
Resource-based policy Bucket/queue/key policy in B allows a principal from A directly Access to a specific resource; caller keeps their own identity

Federation

Federation lets users sign in with an existing identity — corporate directory, SAML identity provider or social login — instead of IAM users.

AWS IAM Identity Center (successor to AWS SSO)

The recommended way to give people access to multiple AWS accounts:

Key idea

For workforce access to many accounts in an AWS Organization, the answer is almost always IAM Identity Center, not IAM users in each account.

AWS Directory Service

Option What it is Use when
AWS Managed Microsoft AD A real Microsoft Active Directory run by AWS You need AD features in AWS (domain-joined Windows instances, FSx for Windows, trusts with on-premises AD)
AD Connector A proxy that forwards authentication to your on-premises AD; stores nothing in AWS Use existing on-prem AD with AWS services without syncing users
Simple AD A small, AD-compatible directory (Samba-based) Basic, low-cost directory needs; limited features

Exam cue: "use existing on-premises Active Directory credentials, without replicating the directory to AWS" → AD Connector.

Amazon Cognito — identity for your app's users

Part Does what
User pools A user directory for authentication: sign-up, sign-in, MFA, social and SAML login, hosted UI; issues JSON Web Tokens (JWTs)
Identity pools (federated identities) Exchange a token (from a user pool, social provider or SAML) for temporary AWS credentials to call AWS services directly

Typical patterns:

Tip

Cognito is for customers of your application. IAM Identity Center is for your workforce accessing AWS accounts. Don't mix them up.

Exam patterns

Bipin Singh
Written by Bipin Singh

Senior Full-Stack Engineer · AI & AWS. I design and run production systems on AWS — serverless, data and AI.

Work with me