SkillSprout
Chapter 3 · Lesson 5
Beginner
5 min read

Root User, Federation and Directory Services

Overview

Every AWS account starts with one all-powerful identity: the root user. Beyond it, organisations need ways to let thousands of people and apps in without creating an IAM user for each one. This lesson covers protecting the root user, identity federation, directories and sharing resources safely.

Imagine a building master key (root user). You lock it in a safe and give staff badges instead. Federation is a badge issued by another trusted authority - your company login - which the building accepts for a day. Cross-account roles are visitor passes for people from a neighbouring building.

This maps to exam Tasks 2.2 and 2.3 and is full of simple "which feature" questions.

Key Concepts

  • The root user has unrestricted access and should be used only for a few tasks that require it.
  • Protect root with a strong password, MFA and no access keys; never use it for daily work.
  • Federation lets users sign in with an existing identity provider (SAML 2.0, OIDC) and receive temporary AWS credentials.
  • IAM Identity Center (successor to AWS SSO) provides single sign-on to multiple accounts and applications.
  • Amazon Cognito manages sign-up, sign-in and access for customers of your web and mobile apps.
  • AWS Directory Service offers managed Microsoft Active Directory and connectors to existing directories.
  • Cross-account roles and AWS RAM (Resource Access Manager) let accounts share access or resources without copying credentials.
  • IAM credential report and Access Advisor show credential status and last service access.

Detailed Notes

Tasks only the root user can perform

Root-only taskWhy
Change account name, email address, root password or root access keysAccount ownership settings
Close the AWS accountHighest-level action
Change or cancel the AWS Support planAccount-level billing relationship
Restore IAM user permissions when no admin canLast-resort recovery
Register as a seller in the Reserved Instance MarketplaceAccount-level capability
Enable MFA delete on S3 buckets (in the legacy method)Account-level control

Everything else, including daily administration, should be done by IAM identities.

Protecting the root user

PracticeDetail
Enable MFAVirtual, hardware TOTP or passkey/security key
No access keysDelete any root access keys
Strong unique passwordStore in a secured password manager
Use a shared mailboxAvoid tying the account to one person
MonitorCloudWatch alarm or EventBridge rule on root sign-in

Identity types

TypeDescriptionBest for
IAM userLong-lived identity with credentials inside one accountSmall setups, legacy tools
IAM roleAssumed identity with temporary credentialsServices, cross-account and federated users
Federated identityExternal identity (corporate directory, Google) mapped to a roleWorkforce access
IAM Identity Center userCentral workforce identity with multi-account accessOrganisations with many accounts
Cognito userCustomer identity for your applicationMobile and web app users

Federation and single sign-on

With federation the identity provider (IdP) authenticates the user and AWS STS issues temporary credentials. Benefits: one place to enforce MFA and offboarding, no extra IAM users and short-lived credentials. IAM Identity Center connects to Microsoft Active Directory, Okta or its own directory and assigns permission sets to accounts.

Cognito versus IAM

QuestionAnswer
Who are the users?Cognito: your application's customers. IAM/Identity Center: your workforce
Can Cognito use Google, Facebook, SAML?Yes, through identity pools and user pools federation
Do customers need AWS accounts?No

Directory Service options

OptionWhen to use
AWS Managed Microsoft ADReal Active Directory in AWS, trusts with on-premises
AD ConnectorProxy requests to an existing on-premises AD
Simple ADBasic, low-cost directory (limited features)

Cross-account access and sharing

json
{
  "Effect": "Allow",
  "Principal": { "AWS": "arn:aws:iam::111122223333:root" },
  "Action": "sts:AssumeRole"
}

A trust policy like this lets account 111122223333 assume a role. AWS Resource Access Manager (RAM) shares resources such as subnets, Transit Gateways and License Manager configurations with other accounts in the Organization without duplication.

Password policies and credential storage

IAM password policies set minimum length, complexity, expiry and reuse rules. Applications should never embed secrets in code: use Secrets Manager (rotation) or Systems Manager Parameter Store.

Access reports

ReportShows
Credential reportAll users and status of passwords, MFA and access keys
IAM Access AdvisorLast time a service was used by a user or role, to trim permissions
IAM Access AnalyzerResources shared externally and unused access

Real World Example

A software company acquires a new AWS account, immediately enables MFA on the root user, deletes root access keys and stores the credentials in a vault. Employees sign in through IAM Identity Center connected to the corporate directory and receive time-limited permission sets per account.

The mobile app uses Amazon Cognito for customer sign-in with Google login, while a partner agency assumes a cross-account role to deploy updates. Subnets are shared to other accounts with RAM, and each quarter the security team reviews the credential report to remove stale users.

Architecture Diagram

Federated access with temporary credentials
Architecture
Employee
Identity providercorporate directory
AWS
IAM Identity Center
Roletemporary credentials
  1. 1The employee signs in to the corporate identity provider.
  2. 2The provider sends an assertion to IAM Identity Center or STS.
  3. 3AWS verifies trust and issues temporary credentials for a role.
  4. 4The employee accesses AWS resources until the session expires.

Best Practices

  • ✓Lock root with MFA, remove access keys and use it only for root-only tasks.
  • ✓Prefer federation and IAM Identity Center over many individual IAM users.
  • ✓Use roles (including cross-account roles) instead of sharing access keys.
  • ✓Use Cognito for customer identities, not IAM users.
  • ✓Review the credential report and Access Advisor regularly to remove unused access.

Common Interview Questions

Exam Tips

CLF-C02 focus

  • "Task only root can perform" - closing the account or changing the support plan.
  • "Single sign-on to multiple accounts" = IAM Identity Center.
  • "Sign-up and sign-in for mobile app users" = Amazon Cognito.
  • "Credential report" lists users and MFA status; "Access Advisor" shows last-used services.

Finished this lesson?

0 of 43 lessons done · 0% of the course