Reading30 min read·Module 1

Directory Services & Federation (SAML, OIDC)

Key concepts

  • AWS Directory Service options

  • AD Connector vs Managed AD

  • SAML 2.0 federation

  • OIDC federation

  • Cognito for web/mobile apps

The Monday Trailbase Had 400 New Coworkers

The acquisition closed on a Friday. Alpenglow Outfitters, a national outdoor-gear retailer, bought Trailbase for its trail data and its community of hikers, and by Monday morning Dana had a new org chart and a request from Alpenglow corporate IT: 400 employees need access to the Trailbase AWS environment. Warehouse analysts want the trail-popularity data, the BI team wants dashboards, and a squad of Windows administrators is planning to move Alpenglow inventory servers into one of the Trailbase accounts.

Every one of those 400 people already has an identity. It lives in Alpenglow's on-premises Microsoft Active Directory (AD), the directory server their IT team has curated for fifteen years: user accounts, group memberships, password policy, MFA, and a joiner-mover-leaver process wired straight into HR.

Dana's post-Theo reflex is to create IAM users, but she does the math and stops. Four hundred IAM users would be copies of identities that already exist somewhere else, and copies drift. When Alpenglow offboards an employee, HR disables the AD account, and no ticket in the world guarantees that somebody also remembers the twin IAM user. Duplicated identity is standing access on a delay timer.

The fix is federation: configuring AWS to trust the system that already holds the identities. An external identity provider (IdP), the software that authenticates users and vouches for them, performs the sign-in, and AWS exchanges that proof for the temporary STS credentials you met in lesson 4. Nobody creates 400 users, and when Alpenglow disables an AD account, its AWS access dies with it.

The Decision Map for This Lesson

Need full AD features inside AWS? AWS Managed Microsoft AD. Need AWS services to reach an on-premises AD without copying it? AD Connector. Need basic directory features on a budget? Simple AD. Need sign-in for a mobile or web app? Amazon Cognito. Need workforce SSO across accounts? IAM Identity Center.

Exam Tip

Three limitation facts solve most SAA-C03 directory questions on their own: Simple AD supports neither trust relationships nor MFA, AD Connector is a pure proxy that caches nothing, and AWS Managed Microsoft AD is the only option that can form a trust with on-premises AD.


Mara Clicks a Bookmark: The SAML Flow

Within two weeks the two IT teams wire up federation, and Mara gains access to the shared analytics account without anyone creating her a second identity. Watch exactly what happens when she signs in, because the exam tests this flow step by step.

She clicks a bookmark to Alpenglow's identity portal. The portal runs ADFS (Active Directory Federation Services), Microsoft's federation server that fronts AD, and it authenticates her against the directory with her ordinary corporate password and MFA prompt. AWS never sees that password.

ADFS then builds a SAML assertion: a digitally signed XML document stating who Mara is, which IAM roles she may assume, and how long her session may last. Her browser posts the assertion to the AWS sign-in endpoint, AWS validates the signature against the SAML provider registered in IAM, and STS answers an AssumeRoleWithSAML call with temporary credentials. Her console opens about two seconds after the click, and no long-lived credential exists anywhere in the chain.

Federation Flow
Figure 1: SAML and OIDC federation flow for AWS access. The external IdP authenticates the user, and AWS exchanges the signed proof for temporary STS credentials.

SAML 2.0 Federation

Security Assertion Markup Language (SAML) 2.0 is an XML-based standard for exchanging authentication data between an identity provider and a service provider.

The flow has four beats: the user authenticates with the IdP, the IdP generates a signed XML assertion, the user presents that assertion to AWS, and AWS validates it and provides access.

AWS accepts SAML in three places: IAM (direct federation), IAM Identity Center, and Amazon Cognito identity pools. Common SAML IdPs include Okta, Azure AD, Ping Identity, ADFS, and Google Workspace.

The plumbing behind Mara's two seconds takes three moves on the AWS side. First, Trailbase registers Alpenglow's IdP in IAM by uploading its metadata document, the XML file that carries the IdP signing certificate:

SHCreate SAML Identity Provider (CLI)
# Create SAML provider with metadata from your IdP
aws iam create-saml-provider \
  --name ExampleOktaProvider \
  --saml-metadata-document file://metadata.xml

Second, the roles that federated users assume need a trust policy naming that provider as the trusted party. Read it as a sentence: anyone this provider vouches for may call sts:AssumeRoleWithSAML, provided the assertion was minted for the AWS sign-in endpoint. That is what the SAML:aud (audience) condition checks.

JSONSAML Federation Trust Policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Federated": "arn:aws:iam::123456789012:saml-provider/ExampleOktaProvider"
      },
      "Action": "sts:AssumeRoleWithSAML",
      "Condition": {
        "StringEquals": {
          "SAML:aud": "https://signin.aws.amazon.com/saml"
        }
      }
    }
  ]
}

Third, the IdP is configured to state which roles each user may assume, by including a role attribute in every assertion. The attribute is https://aws.amazon.com/SAML/Attributes/Role, and its value pairs a role ARN with the provider ARN, for example arn:aws:iam::123456789012:role/FederatedRole,arn:aws:iam::123456789012:saml-provider/ExampleOktaProvider. Alpenglow maps AD groups to those role values, so day-to-day access management stays where it always lived: in the directory.

Q

Which federation protocol uses XML-based assertions for authentication?

AOAuth 2.0
BOpenID Connect
CSAML 2.0
DKerberos

The Hikers Were Federating All Along

Midway through the integration project, Theo points out something nobody had framed this way: the Trailbase mobile app has been doing federation since launch. Hikers sign in with their Google accounts, and the app has never stored a password. The protocol is different, though, and the difference is one of the exam's favorite distinctions.

OpenID Connect (OIDC) is a modern authentication protocol built on OAuth 2.0, the authorization framework that lets one application grant another limited access. Where SAML speaks signed XML through a browser, OIDC issues an ID token in JWT format (JSON Web Token, a compact signed JSON credential built for mobile apps and APIs). The application then exchanges that token for AWS credentials through sts:AssumeRoleWithWebIdentity.

OpenID Connect (OIDC) Federation

OpenID Connect federation follows the same shape as SAML with lighter machinery: the user authenticates with the OIDC provider, the provider issues an ID token in JWT format, the application exchanges the token for AWS credentials, and AWS STS validates it and issues temporary credentials.

AWS accepts OIDC in IAM (web identity federation), Amazon Cognito (user pools and identity pools), and EKS, where pods obtain IAM roles through the cluster OIDC provider (IRSA).

Common OIDC providers include Google, Facebook, and Amazon on the consumer side, Okta, Auth0, and Azure AD on the workforce side, plus GitHub.

The rule of thumb Dana writes on the whiteboard: SAML is for workforces that live in an enterprise directory behind an IdP, and OIDC is for consumer applications, mobile clients, and machine workloads like EKS pods. Alpenglow employees enter through SAML; Trailbase hikers enter through OIDC.


A Million Hikers Cannot Share One Role

Signing hikers in was never the whole problem. After authentication, the app needs scoped AWS access: each hiker should upload photos to their own S3 prefix and touch nobody else's. Amazon Cognito is the service built for exactly this, and it comes in two halves that the exam loves to confuse.

Amazon Cognito

Amazon Cognito provides authentication for web and mobile applications through two components.

User Pools are a user directory for app authentication: sign-up and sign-in, social and SAML/OIDC federation, MFA support, and JWT token generation.

Identity Pools (federated identities) exchange tokens for AWS credentials: they support authenticated and guest access, map users to IAM roles, and enable fine-grained access control.

Used together, the User Pool authenticates and the Identity Pool provides AWS credentials.

Cognito User Pools vs Identity Pools

AspectUser PoolsIdentity Pools
PurposeAuthentication (who are you)Authorization (what can you access)
OutputJWT tokensAWS credentials
FederationSAML, OIDC, socialUser pool tokens, SAML, social
User StorageYes (directory)No (maps identities)
MFAYesVia User Pool
Best ForApp sign-inAWS resource access

For Trailbase, a user pool fronts the mobile app and handles the Google sign-in along with native email accounts:

SHCreate User Pool (CLI)
aws cognito-idp create-user-pool \
  --pool-name MyAppUserPool \
  --policies "PasswordPolicy={MinimumLength=8,RequireUppercase=true,RequireLowercase=true,RequireNumbers=true}" \
  --auto-verified-attributes email \
  --mfa-configuration OPTIONAL

An identity pool then sits behind it, trading the user pool JWT for temporary credentials:

SHCreate Identity Pool (CLI)
aws cognito-identity create-identity-pool \
  --identity-pool-name MyAppIdentityPool \
  --allow-unauthenticated-identities \
  --cognito-identity-providers \
    ProviderName=cognito-idp.us-east-1.amazonaws.com/us-east-1_abc123,ClientId=1234567890abcdef

The IAM role the identity pool hands out has its own trust policy, and the two conditions in it matter. The aud claim pins the token to this specific identity pool, and amr (authentication methods reference) restricts the role to authenticated users, keeping guests on a separate, weaker role.

JSONIdentity Pool Trust Policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Federated": "cognito-identity.amazonaws.com"
      },
      "Action": "sts:AssumeRoleWithWebIdentity",
      "Condition": {
        "StringEquals": {
          "cognito-identity.amazonaws.com:aud": "us-east-1:12345678-1234-1234-1234-123456789012"
        },
        "ForAnyValue:StringLike": {
          "cognito-identity.amazonaws.com:amr": "authenticated"
        }
      }
    }
  ]
}
Q

A mobile application needs to allow users to sign in with their Facebook accounts and then access user-specific data in S3. What AWS services should be used?

AIAM Identity Center with SAML
BCognito User Pool + Identity Pool
CDirect IAM SAML federation
DSimple AD with RADIUS

The Inventory Servers Need a Domain

Federation solves humans at keyboards. Alpenglow's Windows administrators arrive with a different problem: the inventory servers they are lifting into a Trailbase account expect to live in a domain. Windows workloads want domain join, group policy, Kerberos sign-in, and LDAP (Lightweight Directory Access Protocol, the query protocol directories speak). AWS Directory Service offers three ways to provide that, and choosing among them is a guaranteed exam scenario.

Directory Services Options
Figure 2: AWS Directory Service options and their use cases

AWS Managed Microsoft AD

AWS Managed Microsoft AD is a fully managed Microsoft Active Directory running on actual Windows Server, with nothing emulated.

It supports trust relationships with on-premises AD, deploys Multi-AZ for high availability, handles backups and patching automatically, supports MFA through RADIUS integration (RADIUS is a network protocol that relays authentication requests to an MFA server), and allows schema extensions.

It is the best fit for Windows workloads needing full AD, trust relationships with on-premises directories, applications requiring LDAP, and RDS for SQL Server authentication.

Trailbase deploys Managed Microsoft AD in the shared-services account and establishes a trust relationship with the Alpenglow forest: an agreement between two directories that lets users in one authenticate to resources in the other. The inventory servers join the cloud domain, and Alpenglow admins sign in to them with the on-premises identities they have held for years. No passwords were synchronized and no accounts were duplicated.

Q

Which AWS Directory Service option supports trust relationships with on-premises Active Directory?

ASimple AD
BAD Connector
CAWS Managed Microsoft AD
DAmazon Cognito

There were two roads not taken, and the exam expects you to know why each exists.

AD Connector

AD Connector is a directory gateway that proxies requests to your on-premises Microsoft AD. No directory data is stored in AWS at all.

It offers low latency to the on-premises AD, supports MFA via RADIUS, and works with WorkSpaces, WorkDocs, and WorkMail.

Its limitations follow from being a proxy: it requires VPN or Direct Connect to the data center, cannot be shared across AWS accounts, is not multi-VPC aware, and performs no caching, so every authentication depends on live connectivity. It suits organizations that want AWS services to use their existing AD without replicating anything to the cloud.

Simple AD

Simple AD is a directory based on Samba 4, an open-source reimplementation of Microsoft directory protocols, compatible with basic AD features.

It costs less than Managed Microsoft AD, provides users, groups, and policies with Kerberos-based SSO, and comes in two sizes: Small (up to 500 users) or Large (up to 5,000 users).

The trade-offs are long: no trust relationships, no MFA support, no schema extensions, no PowerShell AD cmdlets, no DNS dynamic updates, and no compatibility with RDS for SQL Server. It fits small organizations with basic directory needs, Linux workloads that just want LDAP, and cost-sensitive environments.

Directory Service Comparison

FeatureManaged Microsoft ADAD ConnectorSimple AD
TypeFull Windows ADProxy to on-premSamba-based AD
Trust RelationshipsYesVia on-prem ADNo
MFA SupportYes (RADIUS)Yes (RADIUS)No
Schema ExtensionsYesVia on-prem ADNo
Users SupportedUnlimitedDepends on on-prem500 or 5,000
Multi-AZYesYesYes
Share Across AccountsYesNoNo
RDS SQL ServerYesYesNo
PricingHighestMediumLowest

Standing up the chosen directory is two CLI calls away. The Managed Microsoft AD deployment spans two subnets because Multi-AZ is built in:

SHCreate Managed Microsoft AD (CLI)
aws ds create-microsoft-ad \
  --name corp.example.com \
  --short-name CORP \
  --password 'ComplexPassword123!' \
  --edition Standard \
  --vpc-settings VpcId=vpc-12345678,SubnetIds=subnet-11111111,subnet-22222222

Had Trailbase gone the proxy route instead, an AD Connector needs the on-premises DNS servers and a service account to bind with:

SHCreate AD Connector (CLI)
aws ds connect-directory \
  --name corp.example.com \
  --short-name CORP \
  --password 'ServiceAccountPassword!' \
  --size Small \
  --connect-settings VpcId=vpc-12345678,SubnetIds=subnet-11111111,subnet-22222222,CustomerDnsIps=10.0.0.10,10.0.0.11,CustomerUserName=svc_adconnector
Q

What is the key difference between AD Connector and AWS Managed Microsoft AD?

AAD Connector supports MFA, Managed AD does not
BAD Connector stores user data in AWS, Managed AD does not
CAD Connector is a proxy to on-premises AD, Managed AD runs AD in AWS
DAD Connector is cheaper for large organizations

Trailbase and Alpenglow, Wired Together

Six months after the acquisition, every population enters through the door built for it. Workforce access runs through IAM Identity Center, which you configured in lesson 6: it now uses the Managed Microsoft AD as its identity source, and permission sets map Alpenglow AD groups onto roles across every account in the organization. Hikers enter through Cognito, trading Google sign-ins for credentials scoped to their own photos. The inventory servers live in the cloud domain, trusted by the on-premises forest.

Priya still audits through her cross-account role. When Alpenglow's external accounting firm needed similar access, Trailbase set up direct IAM SAML federation with the firm's own IdP instead, and the partners received temporary credentials without a single IAM user being created. Two mechanisms, one principle: temporary access for people whose identities live elsewhere.

Directory Service Best Practices

Choose based on actual requirements, since Simple AD may be enough. Deploy Multi-AZ, which every directory type supports. Place the directory in dedicated subnets. Monitor health and performance with CloudWatch. Enable automated snapshots for recovery. Secure service accounts with strong passwords and regular rotation.

Federation Best Practices

Prefer IAM Identity Center for workforce access over direct IAM SAML. Use Cognito for customer identity, since it is purpose-built for app authentication. Require MFA at the IdP level. Keep session durations short to minimize credential lifetime. Audit federation events with CloudTrail. Map groups to roles rather than creating individual assignments.

Exam Tip

SAA-C03 federation questions almost always name a population. Employees or workforce means IAM Identity Center with SAML. App users, mobile, or social login means Cognito with OIDC. Windows servers needing domain join means the Directory Service family, and the trust-relationship requirement filters it down to Managed Microsoft AD.

Exam Scenarios

ScenarioSolutionWhy
Windows EC2 instances need domain joinAWS Managed Microsoft ADFull AD features for Windows workloads
Use existing on-premises AD without syncAD ConnectorProxy to on-prem, no data in cloud
Small team needs basic user directorySimple ADCost-effective for basic needs
Mobile app needs Facebook/Google loginCognito User Pool with social IdPBuilt-in social federation
App users need S3 access based on identityCognito Identity PoolExchange tokens for AWS credentials
Enterprise employees need AWS Console SSOIAM Identity Center with SAMLWorkforce SSO solution
Trust relationship between cloud and on-prem ADAWS Managed Microsoft ADOnly option supporting AD trusts
Third-party SaaS needs temporary AWS accessIAM SAML federationCross-organization federation

Common Pitfalls

Simple AD Where a Trust Is Required

Simple AD cannot form trust relationships and cannot connect to an on-premises forest; it is a standalone directory, full stop. The moment a scenario mentions trusts or an existing on-premises AD, the answer is AWS Managed Microsoft AD, or AD Connector proxying to the on-premises directory.

AD Connector on a Single VPN

AD Connector caches nothing, so authentication is only as available as the network path beneath it. One VPN tunnel means one point of failure for every sign-in. Deploy redundant VPN or Direct Connect links, monitor connectivity health, or choose Managed Microsoft AD with a trust when resilience matters more than avoiding replication.

Mixing Up the Two Cognito Pools

User pools authenticate and issue JWT tokens; identity pools authorize by exchanging tokens for AWS credentials. Using the wrong one gets you nowhere: an identity pool cannot sign users up, and a user pool token cannot call S3 by itself. They are usually chained, with the user pool signing people in and the identity pool minting credentials.

Federation Secrets Hardcoded in Apps

IdP metadata and secrets embedded in application code can be exposed and are painful to rotate. Keep sensitive values in AWS Secrets Manager, let the Cognito SDK handle token management, and store IdP configuration in environment variables.


Quick Reference

Directory Service Sizing

ServiceSizeUsersUse Case
Simple ADSmallUp to 500Small teams, testing
Simple ADLargeUp to 5,000Medium organizations
AD ConnectorSmallUp to 500Small hybrid deployments
AD ConnectorLargeUp to 5,000Large hybrid deployments
Managed ADStandardUp to 5,000Most production workloads
Managed ADEnterpriseUp to 100,000+Large enterprises

When to Use Each Federation Method

ScenarioRecommended ServiceProtocol
Workforce SSO to AWS ConsoleIAM Identity CenterSAML 2.0
Mobile app with social loginCognito User PoolOIDC
App users need AWS credentialsCognito Identity PoolOIDC/SAML
Third-party vendor AWS accessIAM SAML ProviderSAML 2.0
Kubernetes pod IAM roles (EKS)IAM OIDC ProviderOIDC
Enterprise SSO to AWS ConsoleIAM Identity CenterSAML 2.0
SHDirectory Service CLI Commands
# List directories
aws ds describe-directories

# Create Microsoft AD
aws ds create-microsoft-ad --name corp.example.com --password 'Password' --edition Standard --vpc-settings VpcId=vpc-xxx,SubnetIds=subnet-xxx

# Create trust relationship
aws ds create-trust --directory-id d-xxx --remote-domain-name onprem.example.com --trust-password 'TrustPassword' --trust-direction Two-Way

# Create AD Connector
aws ds connect-directory --name corp.example.com --password 'Password' --size Small --connect-settings VpcId=vpc-xxx,SubnetIds=subnet-xxx,CustomerDnsIps=10.0.0.10

# Delete directory
aws ds delete-directory --directory-id d-xxx
SHCognito CLI Commands
# Create User Pool
aws cognito-idp create-user-pool --pool-name MyPool

# Create User Pool Client
aws cognito-idp create-user-pool-client --user-pool-id us-east-1_xxx --client-name MyAppClient

# Create Identity Pool
aws cognito-identity create-identity-pool --identity-pool-name MyIdentityPool --allow-unauthenticated-identities

# List User Pools
aws cognito-idp list-user-pools --max-results 10

# Get Identity Pool roles
aws cognito-identity get-identity-pool-roles --identity-pool-id us-east-1:xxx
TEXTRequired SAML Attributes
# Role attribute (required)
Name: https://aws.amazon.com/SAML/Attributes/Role
Value: arn:aws:iam::ACCOUNT:role/ROLE,arn:aws:iam::ACCOUNT:saml-provider/PROVIDER

# Session duration (optional)
Name: https://aws.amazon.com/SAML/Attributes/SessionDuration
Value: 3600 (seconds, max 43200)

# Role session name (optional but recommended)
Name: https://aws.amazon.com/SAML/Attributes/RoleSessionName
Value: user@example.com


Further Reading

Related services

Directory ServiceCognitoIAM