Identity Federation & Active Directory

Let identities that live outside AWS in — no IAM users. Exam themes: the four flavors (SAML, custom broker, web identity, Identity Center), what actually travels on the wire, and how Active Directory / ADFS / AWS Directory Services fit together.

Cho danh tính ngoài AWS vào — không tạo IAM user. Bài exam: bốn flavor (SAML, custom broker, web identity, Identity Center), thứ gì thật sự chạy trên dây, và AD / ADFS / AWS Directory Services ghép với nhau ra sao.

Reach for which flavorChọn flavor nào

  • SAML 2.0 / ADFS — corporate has a SAML-compatible IdP, workforce needs Console/CLISAML 2.0 / ADFS — công ty có IdP hỗ trợ SAML, workforce cần Console/CLI
  • Custom Identity Broker — IdP is not SAML 2.0 compatibleCustom Identity Broker — IdP không hỗ trợ SAML 2.0
  • Web Identity + Cognito — web/mobile app, users log in with Google / Facebook / AppleWeb Identity + Cognito — app web/mobile, user login qua Google / Facebook / Apple
  • IAM Identity Center — many accounts in an Organization, want one portal + permission setsIAM Identity Center — nhiều account trong Organization, muốn 1 portal + permission set

Not the right toolKhông phải chỗ dùng

  • Web Identity Federation without Cognito — AWS says use Cognito insteadWeb Identity Federation không Cognito — AWS khuyên dùng Cognito
  • Federating customers into IAM roles one-by-one — that's Cognito's jobFederate từng khách vào IAM role — đó là việc của Cognito
  • Manual per-account SAML wiring for a big Organization — use Identity CenterWire SAML thủ công từng account cho Org lớn — dùng Identity Center

What federation isFederation là gì

User management stays outside AWS. AWS and the Identity Provider (IdP) hold a trust; the user logs into the IdP, gets a credential the IdP vouches for, and trades it for AWS access. Quản lý user nằm ngoài AWS. AWS và Identity Provider (IdP) giữ một trust; user login vào IdP, nhận credential do IdP bảo lãnh, rồi đổi lấy quyền vào AWS.

The federation trust triangle. A user logs into an identity provider and receives credentials back. The identity provider and AWS hold a trust relationship. The user then uses that to access AWS. User Identity Provider ADFS · Okta · Google… AWS login → ← credentials trust relationship access

Three edges: user↔IdP (login), IdP↔AWS (the trust set up once), user→AWS (access). No IAM user is ever created — the trust is what makes AWS accept the IdP's word.

Ba cạnh: user↔IdP (login), IdP↔AWS (trust dựng một lần), user→AWS (truy cập). Không tạo IAM user nào — chính trust khiến AWS chịu tin lời IdP.

The four flavorsBốn flavor

SAML 2.0 Corporate IdP (ADFS). AssumeRoleWithSAML. The "old way".IdP công ty (ADFS). AssumeRoleWithSAML. Kiểu "cũ".
Custom Identity BrokerCustom Identity Broker IdP not SAML-compatible. AssumeRole / GetFederationToken.IdP không hỗ trợ SAML. AssumeRole / GetFederationToken.
Web Identity (Cognito)Web Identity (Cognito) App/mobile, Google/FB/Apple. AssumeRoleWithWebIdentity.App/mobile, Google/FB/Apple. AssumeRoleWithWebIdentity.
IAM Identity Center Managed, org-wide, portal. The new way.Managed, org-wide, có portal. Kiểu mới.

SAML 2.0 Federation — the flowSAML 2.0 Federation — luồng chạy

The IdP authenticates the user against its store, hands back a signed SAML assertion, and the user trades that to STS for temp creds. Trust is set up both ways between AWS IAM and the SAML IdP. IdP xác thực user với kho của nó, trả về SAML assertion có chữ ký, user đổi cái đó lấy cred tạm ở STS. Trust dựng cả hai chiều giữa AWS IAM và SAML IdP.

The SAML 2.0 federation flow for AWS API access. Step 1 the user logs into the corporate portal / IdP. Step 2 the IdP authenticates against the AD / LDAP store. Step 3 the IdP returns a SAML assertion to the user. Step 4 the user calls STS AssumeRoleWithSAML with that assertion. Step 5 STS returns temporary credentials. Step 6 the user accesses the S3 bucket. Corporate (IdP) AWS Cloud Portal / IdP (ADFS) AD · LDAP store 2. authenticate User STS S3 bucket 1. login 3. SAML assertion 4. AssumeRoleWithSAML 5. temp creds 6. access S3

Left half happens in the corporate network (auth → assertion). Right half is pure STS: assertion in, temp creds out, then normal signed API calls. The user never holds a long-lived AWS key.

Nửa trái xảy ra trong mạng công ty (auth → assertion). Nửa phải thuần STS: đưa assertion vào, nhận cred tạm ra, rồi gọi API ký bình thường. User không bao giờ giữ AWS key vĩnh viễn.

What actually travels on the wire — the three artifacts: Thứ thật sự chạy trên dây — ba vật thể:

<!-- STEP 3: SAML assertion (signed XML), trimmed -->
<saml:Assertion>
  <saml:Subject><saml:NameID>[email protected]</saml:NameID></saml:Subject>
  <saml:Conditions>
    <saml:Audience>urn:amazon:webservices</saml:Audience>   <!-- dành cho AWS -->
  </saml:Conditions>
  <saml:AttributeStatement>
    <saml:Attribute Name="https://aws.amazon.com/SAML/Attributes/Role">
      arn:aws:iam::123456789012:role/CorpDev,arn:aws:iam::123456789012:saml-provider/CorpADFS
    </saml:Attribute>
    <saml:Attribute Name="…/RoleSessionName">[email protected]</saml:Attribute>
    <saml:Attribute Name="…/SessionDuration">3600</saml:Attribute>
  </saml:AttributeStatement>
  <ds:Signature>… ký bằng X.509 cert của IdP …</ds:Signature>   <!-- AWS tin chữ ký -->
</saml:Assertion>
# STEP 4: trade the assertion for creds (no AWS access key needed)
aws sts assume-role-with-saml \
  --role-arn       arn:aws:iam::123456789012:role/CorpDev \
  --principal-arn  arn:aws:iam::123456789012:saml-provider/CorpADFS \
  --saml-assertion "PHNhbWw6QXNzZXJ0aW9u…(base64 của XML ở B3)…"
// STEP 5: STS returns 3-part temp creds
{ "Credentials": {
    "AccessKeyId":     "ASIAWXYZEXAMPLE123",          // ASIA… = tạm (key thường = AKIA…)
    "SecretAccessKey": "wJalrXUtnFEMI/K7MDENG/EXAMPLE",
    "SessionToken":    "FQoGZXIvYXdzEJ…//////////wEa…",// dấu hiệu cred tạm
    "Expiration":      "2026-08-13T09:15:00Z" },
  "AssumedRoleUser": { "Arn": "arn:aws:sts::123456789012:assumed-role/CorpDev/[email protected]" } }
The Role attribute is a pairRole attribute là một cặp Its value is role-arn,saml-provider-arn (comma-separated). Those map straight onto the two AssumeRoleWithSAML params. Multiple Role values → the Console shows a role picker. Giá trị là role-arn,saml-provider-arn (cách nhau dấu phẩy). Hai cái này map thẳng vào 2 tham số của AssumeRoleWithSAML. Nhiều giá trị Role → Console hiện màn hình chọn role.
Console access differs at step 4Console access khác ở bước 4 For Console access the browser POSTs the assertion to https://signin.aws.amazon.com/saml; AWS sign-in calls STS itself, builds a sign-in URL, and redirects the browser into the Console. The user never sees the creds. Với Console, browser POST assertion tới https://signin.aws.amazon.com/saml; AWS sign-in tự gọi STS, dựng sign-in URL rồi redirect browser vào Console. User không thấy cred.

Custom Identity BrokerCustom Identity Broker

Use it only when the IdP is not SAML 2.0 compatible. Your broker app authenticates the user, picks the right IAM role, and calls STS itself. Chỉ dùng khi IdP không hỗ trợ SAML 2.0. App broker của bạn xác thực user, tự chọn IAM role phù hợp, rồi gọi STS.

The custom identity broker flow. Step 1 the user browses to a URL at the custom identity broker. Step 2 the broker authenticates the user against an LDAP identity store. Step 3 the broker itself requests temporary security credentials from STS. Step 4 the broker returns a token or URL to the user. Step 5 the user accesses AWS APIs or is redirected to the console. The key difference from SAML: the broker calls STS, not the user. Corporate (IdP) AWS Cloud Custom Identity Broker LDAP identity store 2. authenticate User STS AWS services · Console 1. browse to URL 4. token / URL 3. broker requests temp creds → STS 5. access / redirect

The tell vs SAML: here the broker calls STS (step 3) and hands the user a token/URL (step 4) — the user never talks to STS directly. The broker owns both the authentication and the role-mapping.

Khác SAML ở chỗ: ở đây broker gọi STS (bước 3) rồi đưa user token/URL (bước 4) — user không hề nói chuyện trực tiếp với STS. Broker ôm cả phần xác thực lẫn map role.

  • The broker must determine the appropriate IAM Role for each user — that logic lives in your code, not in AWS. Broker phải tự quyết IAM Role phù hợp cho từng user — logic đó nằm trong code của bạn, không phải AWS.
  • Uses the STS API AssumeRole or GetFederationToken to mint temp creds, then hands a token/URL back to the user. Dùng STS AssumeRole hoặc GetFederationToken tạo cred tạm, rồi trả token/URL cho user.
  • Same shape as SAML federation, but you build the authentication + role-mapping instead of relying on SAML. Cùng dạng với SAML federation, nhưng bạn tự làm phần xác thực + map role thay vì dựa vào SAML.

Web Identity Federation & CognitoWeb Identity Federation & Cognito

For web/mobile app users logging in with Google / Facebook / Apple / any OIDC IdP. Without Cognito → AssumeRoleWithWebIdentity directly (AWS says don't). With Cognito → the recommended path. Cho user app web/mobile login qua Google / Facebook / Apple / bất kỳ OIDC IdP. Không Cognito → gọi thẳng AssumeRoleWithWebIdentity (AWS khuyên đừng). Có Cognito → đường khuyến nghị.

Two token-hop rows. Without Cognito: the OIDC identity provider returns an ID token to the app, which passes that same ID token straight to STS via AssumeRoleWithWebIdentity. With Cognito: the identity provider returns the same ID token to the app, the app passes it to Cognito, Cognito issues its own Cognito token, and that is exchanged with STS. The first hop, identity provider to app, is the identical ID token in both cases; only the consumer downstream differs. ① Without Cognito — client tự đổi thẳng ID token (JWT) AssumeRoleWithWebIdentity Google / OIDC IdP App / client STS ② With Cognito — Cognito chèn vào giữa ID token (JWT) ID token Cognito token Google / OIDC IdP App / client Cognito STS

The blue hop (IdP → app) is the same ID token in both — a standard OIDC JWT; the IdP has no idea Cognito exists. Only the consumer differs: raw sends it straight to STS; Cognito takes it, re-issues its own token, and brokers the exchange.

Chặng xanh (IdP → app) là cùng một ID token ở cả hai — một OIDC JWT chuẩn; IdP không biết Cognito tồn tại. Chỉ khác ở bên tiêu thụ: raw đưa thẳng cho STS; Cognito nhận vào, tự phát token của nó, rồi làm trung gian đổi creds.

Without CognitoKhông Cognito With CognitoCó Cognito
Who trades the tokenAi đổi token Client → STS directlyClient → STS trực tiếp Client → Cognito → STSClient → Cognito → STS
AWS stanceAWS khuyến nghị Not recommendedKhông khuyên PreferredƯu tiên
ExtrasThêm —— Anonymous users · MFA · data syncUser ẩn danh · MFA · đồng bộ dữ liệu
Why the 3 extras are even possible — stateful identityVì sao có được 3 extra — danh tính có trạng thái Raw AssumeRoleWithWebIdentity is a stateless swap: token in → creds out, nothing remembered. Cognito keeps a persistent identity ID (+ optionally a user directory), and that's what unlocks all three: anonymous users (issues creds for a guest role with no upstream token — raw can't, it requires a token) · MFA (Cognito actively runs the login, so it can challenge; raw only validates a token someone else made) · data sync (needs a durable identity to attach data to). Raw AssumeRoleWithWebIdentity là swap không trạng thái: đưa token vào → nhả creds → quên sạch. Cognito giữ một identity ID bền vững (+ tùy chọn cả user directory), và đó là thứ mở khóa cả ba: user ẩn danh (cấp creds cho guest role mà không cần token upstream — raw không làm được vì bắt buộc có token) · MFA (Cognito chủ trì login nên có thể thách thức; raw chỉ verify token do bên khác phát) · data sync (cần danh tính bền để gắn dữ liệu).
Preferred despite the extra hopƯu tiên dù thêm một chặng The hop is cheap (in the enhanced flow Cognito calls STS for you → fewer client calls). The real wins are dev/security-side: role ARN + trust config stay off the client · one identity ID across multiple IdPs (Google + Facebook) · guest → login upgrade path · centralized role mapping (least privilege). Raw federation pushes role + trust logic into client code — exactly why AWS marks it "not recommended". Chặng này rẻ (ở enhanced flow Cognito gọi STS hộ → client gọi ít hơn). Giá trị thật ở phía dev/security: role ARN + trust config nằm ngoài client · một identity ID cho nhiều IdP (Google + Facebook) · đường nâng cấp guest → login · role mapping tập trung (least privilege). Raw federation đẩy logic role + trust vào code client — đúng lý do AWS ghi "không khuyên".
Cognito replaces the Token Vending Machine (TVM)Cognito thay Token Vending Machine (TVM) Create IAM roles via Cognito with least privilege, build trust between the OIDC IdP and AWS, and Cognito hands out the temp creds — no home-grown token server. Tạo IAM role qua Cognito với least privilege, dựng trust giữa OIDC IdP và AWS, Cognito lo phát cred tạm — không cần tự dựng token server.

After web-identity auth you can pin each user to their own data with an IAM policy variable — the IdP's user-id substituted into the resource ARN: Sau khi auth web-identity, có thể ghim mỗi user vào đúng data của họ bằng IAM policy variable — user-id của IdP được thế vào ARN resource:

{ "Effect": "Allow",
  "Action": ["s3:GetObject", "s3:PutObject"],
  "Resource": "arn:aws:s3:::myBucket/game/${www.amazon.com:user_id}/*" }

// các biến hay gặp:
//   cognito-identity.amazonaws.com:sub   graph.facebook.com:id
//   www.amazon.com:user_id               accounts.google.com:sub

Old way vs new way — SAML vs IAM Identity CenterOld way vs new way — SAML vs IAM Identity Center

SAML 2.0 (old)SAML 2.0 (cũ) IAM Identity Center (new)IAM Identity Center (mới)
SetupSetup Manual: SAML provider + roles per accountThủ công: SAML provider + role từng account Managed: one identity source + permission setsManaged: một identity source + permission set
ScopePhạm vi Per-account wiringWire từng account Whole Organization at onceCả Organization một lần
Login portalCổng đăng nhập You build it (IdP side)Bạn tự dựng (bên IdP) Built-in AWS access portalAWS access portal có sẵn
Under the hoodUnder the hood AssumeRoleWithSAMLAssumeRoleWithSAML Managed federation + STSFederation managed + STS
Workforce vs app usersWorkforce vs user app SAML / Identity Center = employees. Cognito = your app's customers. Full Identity Center detail lives on the SSO page. SAML / Identity Center = nhân viên. Cognito = khách của app bạn. Chi tiết Identity Center nằm ở trang SSO.

What is Active Directory (AD)?Active Directory (AD) là gì?

Microsoft's identity database, on any Windows Server with AD Domain Services. Think "the company's registry office + gate guard": it knows every user/computer/printer and checks passwords. Cơ sở dữ liệu danh tính của Microsoft, trên Windows Server có AD Domain Services. Hình dung "phòng hộ tịch + bảo vệ cổng": biết mọi user/máy tính/máy in và kiểm password.

A domain controller at the top holding the account "John / password", with lines fanning down to five client computers it authenticates and manages. Domain Controller holds: John · password PC PC printer file share PC

The Domain Controller is the server that runs AD and answers "is this password right?". Everything managed — users, computers, printers, file shares, security groups — is an object in its database.

Domain Controller là server chạy AD và trả lời "password này đúng không?". Mọi thứ được quản — user, máy tính, máy in, file share, security group — đều là object trong CSDL của nó.

JargonThuật ngữ Object = a managed thing (user, PC…). Objects live in a domain (a namespace like corp.com); domains form a tree; a group of trees is a forest. AD is queried over the LDAP protocol. Object = thứ được quản (user, PC…). Object nằm trong domain (một namespace như corp.com); các domain tạo thành tree; nhóm tree là forest. AD được truy vấn qua giao thức LDAP.

What is ADFS?ADFS là gì?

AD only works inside the corporate network. ADFS is the add-on that turns an AD login into a signed SAML token that external apps trust — giving Single Sign-On across AWS Console, Dropbox, Office365, etc. AD chỉ chạy trong mạng công ty. ADFS là phần gắn thêm, biến login AD thành SAML token có chữ ký mà app bên ngoài tin — cho Single Sign-On qua AWS Console, Dropbox, Office365, v.v.

One-line memoryNhớ một dòng AD = knows who you are (internal). ADFS = issues the "passport" (SAML) so you use that identity to sign into external apps — it's the SAML IdP speaking for AD. LDAP = the protocol to query AD. AD = biết bạn là ai (nội bộ). ADFS = cấp "hộ chiếu" (SAML) để dùng danh tính đó đăng nhập app ngoài — nó là SAML IdP thay mặt AD. LDAP = giao thức tra AD.

AWS Directory ServicesAWS Directory Services

Three ways to have "AD" in AWS. Pick by: do you need a real Microsoft AD, do users stay on-prem, or just something cheap and AD-compatible. Ba cách để có "AD" trong AWS. Chọn theo: cần AD Microsoft thật, user ở on-prem, hay chỉ cần thứ rẻ và tương thích AD.

Three directory-service options side by side. Managed Microsoft AD sits in AWS and forms a two-way trust with on-prem AD. AD Connector is a proxy that forwards to on-prem AD where users are managed. Simple AD is a standalone Samba directory with no trust. Managed Microsoft AD on-prem AD AWS Managed AD AD thật · two-way trust MFA · RDS SQL · SSO AD Connector on-prem AD AD Connector proxy chỉ proxy · user ở on-prem không lưu · không trust Simple AD Simple AD (Samba 4) standalone · rẻ · 500/5000 user KHÔNG MFA · KHÔNG SQL · KHÔNG trust

Managed AD = a real Microsoft AD you run in AWS, can two-way-trust on-prem. AD Connector = a thin proxy; auth is forwarded to on-prem, nothing stored. Simple AD = cheap Samba, none of the trust/MFA/SQL extras.

Managed AD = AD Microsoft thật chạy trong AWS, two-way trust được với on-prem. AD Connector = proxy mỏng; auth chuyển về on-prem, không lưu gì. Simple AD = Samba rẻ, không có trust/MFA/SQL.

Managed Microsoft AD AD Connector Simple AD
What it isLà gì Real MS AD in your VPCAD Microsoft thật trong VPC Gateway/proxy to on-prem ADGateway/proxy về on-prem AD Samba, AD-compatibleSamba, tương thích AD
Users managedUser quản ở In AWS (or joined to on-prem)Trong AWS (hoặc join on-prem) Solely on-premisesChỉ ở on-premises In AWSTrong AWS
Trust with on-premTrust với on-prem Yes (forest trust)Có (forest trust) No trust — it is on-premKhông — nó chính là on-prem NoKhông
MFA · RDS SQL · SSO YesCó MFA yes; no SQL, no seamless joinMFA có; không SQL, không seamless join No MFA, no SQL, no SSOKhông MFA, SQL, SSO

Domain join — what it means to join ADDomain join — "gia nhập AD" nghĩa là gì

Domain join = make a machine (an EC2 instance) a member of the AD domain. After joining, the box has a computer account in AWS Managed AD, trusts the DC, and AD users log in with their AD credentials — no local accounts. AWS Managed AD is the DC; the EC2 is the member. Domain join = biến một máy (một EC2 instance) thành member của AD domain. Join xong, máy có computer account trong AWS Managed AD, tin DC, và user AD login được bằng credential AD — khỏi local account. AWS Managed AD là DC; EC2 là member.

AWS Managed AD acts as the domain controller for corp.com at the top. Below, the same EC2 instance is shown before and after domain join. Before joining it has only a local account, AD users cannot log in, and Kerberos does not work. After joining it is a member of corp.com: AD users like CORP backslash an can log in over RDP or SSH, Group Policy applies, and Kerberos authenticates against the DC. Joining is done seamlessly through SSM. AWS Managed AD Domain Controller · corp.com DC xác thực EC2 · CHƯA join chỉ có local account AD user login ✗ · Kerberos ✗ domain join seamless qua SSM EC2 · ĐÃ join corp.com CORP\an login (RDP/SSH) ✓ GPO áp · Kerberos ↔ DC ✓

Same box, two states. Before: an island with only a local Administrator. After the join it holds a computer account in the domain, so AD logins, Group Policy and Kerberos all flow through the DC. It's "enrol the machine into the company network".

Cùng một máy, hai trạng thái. Trước: một ốc đảo chỉ có local Administrator. Sau khi join, máy có computer account trong domain, nên login AD, Group Policy và Kerberos đều đi qua DC. Chính là "cho máy gia nhập mạng công ty".

How EC2 joins — seamless vs manualEC2 join cách nào — seamless vs thủ công Seamless join (the AWS way): give the EC2 an IAM role with AmazonSSMManagedInstanceCore, pick the directory at launch → SSM joins it for you, no manual command. Manual: Windows Add-Computer/sconfig, Linux realm join + sssd. Either way the instance must reach the directory's DNS (point instance DNS at the directory IPs) and the security group must allow AD ports (DNS 53, Kerberos 88, LDAP 389…). Seamless join (cách AWS): gán cho EC2 một IAM role có AmazonSSMManagedInstanceCore, chọn directory lúc launch → SSM join giúp, không cần gõ tay. Thủ công: Windows Add-Computer/sconfig, Linux realm join + sssd. Cách nào thì instance cũng phải tới được DNS của directory (trỏ DNS instance về IP directory) và security group cho phép các port AD (DNS 53, Kerberos 88, LDAP 389…).
Domain join ≠ IAM permissionDomain join ≠ quyền IAM Joining lets AD users log into the OS (RDP/SSH) — it does not grant any permission to call AWS APIs. AWS access is still IAM (instance role / permission set). Two different layers: AD = who may sign into the machine; IAM = what that machine/role may do in AWS. Join cho phép user AD đăng nhập vào OS (RDP/SSH) — nó không cấp quyền gọi AWS API nào. Quyền AWS vẫn là IAM (instance role / permission set). Hai tầng khác nhau: AD = ai được login vào máy; IAM = máy/role đó được làm gì trong AWS.
  • WorkSpaces, RDS for SQL Server, FSx for Windows, SharePoint all domain-join the same way — they're AD members exactly like the EC2 above. WorkSpaces, RDS for SQL Server, FSx for Windows, SharePoint đều domain-join y hệt — chúng là member của AD đúng như con EC2 ở trên.
  • This is why a Google / SAML identity can't reach a domain-joined resource: it authenticates via Kerberos/LDAP against the DC, not a SAML token. Domain-joined workloads need a real AD identity. Đây là lý do identity Google / SAML không "vào" được resource đã domain-join: nó xác thực bằng Kerberos/LDAP với DC, không phải SAML token. Workload domain-joined cần identity AD thật.
  • Seamless join fails silently without the SSM agent + IAM role, or if the instance can't resolve the directory's DNS. First things to check when a join won't complete. Seamless join fail lặng lẽ nếu thiếu SSM agent + IAM role, hoặc instance không resolve được DNS của directory. Đó là chỗ kiểm đầu tiên khi join không xong.

Connect to on-prem AD — forest trust & replicationNối on-prem AD — forest trust & replication

To join AWS Managed AD with on-prem AD you need Direct Connect or VPN, then a forest trust. Trust ≠ sync: it lets one directory trust the other's logins, it doesn't copy accounts. Để nối AWS Managed AD với on-prem AD cần Direct Connect hoặc VPN, rồi một forest trust. Trust ≠ sync: nó cho directory này tin login của directory kia, không copy account.

On-premises Active Directory on the left and AWS Managed Microsoft AD on the right, connected over Direct Connect or VPN, with three possible forest-trust directions: one-way AWS to on-prem, one-way on-prem to AWS, or two-way. on-premises Microsoft AD AWS Managed Microsoft AD Direct Connect / VPN 1-way: on-prem ⇒ AWS 1-way: AWS ⇒ on-prem cả hai chiều = two-way forest trust

Three flavors: one-way each direction, or two-way. "AWS ⇒ on-prem" means AWS-side resources trust on-prem identities. Separately, you can run a self-managed AD replica on EC2 so logins survive a DX/VPN outage.

Ba kiểu: một chiều mỗi hướng, hoặc hai chiều. "AWS ⇒ on-prem" nghĩa là resource phía AWS tin identity on-prem. Ngoài ra, có thể chạy AD replica tự quản trên EC2 để login vẫn sống khi DX/VPN sập.

Why the replica must be self-managed AD on EC2, not Managed AD: replication only happens inside the same domain/forest. Read the domain names — the EC2 replica shares the on-prem domain; Managed AD is always its own. Vì sao replica phải là AD tự quản trên EC2, không phải Managed AD: replication chỉ xảy ra trong cùng một domain/forest. Đọc domain name — EC2 replica dùng chung domain on-prem; Managed AD luôn là domain riêng.

Three directories. On-prem AD and the AD on EC2 replica both use the domain onpremAD.example.com, so replication flows between them — the same domain, a full copy. AWS Managed AD uses a different domain, awsAD.example.com, so it can only connect via a two-way trust, which does not copy the directory. REPLICATION TRUST on-prem AD onpremAD.example.com AD on EC2 · replica onpremAD.example.com AWS Managed AD awsAD.example.com REPLICATION · cùng domain → EC2 giữ bản sao đầy đủ → auth sống khi DX/VPN đứt TRUST · khác domain → chỉ tin login, KHÔNG copy → auth vẫn phải về chủ domain

Same domain (onpremAD…) → replication → a full local copy that survives a DX/VPN outage. Different domain (awsAD…) → only a trust, which never copies the directory.

Cùng domain (onpremAD…) → replication → bản sao local đầy đủ, sống khi DX/VPN sập. Khác domain (awsAD…) → chỉ có trust, không bao giờ copy directory.

Why Managed AD can't be the replicaVì sao Managed AD không làm replica được Managed AD always creates its own domain/forest — you can't join it into your existing on-prem domain. AWS owns its DCs; you get delegated admin only (no Domain Admin, no DC OS access), which is exactly what promoting a replica DC needs. Different domain → connect via trust, not replication. For a true local copy you must run a DC you fully control → AD on EC2. Managed AD luôn tạo domain/forest riêng — không thể join vào domain on-prem có sẵn của bạn. AWS sở hữu DC của nó; bạn chỉ có delegated admin (không Domain Admin, không truy cập OS của DC) — đúng mấy quyền cần để promote một replica DC. Khác domain → nối bằng trust, không phải replication. Muốn bản sao local thật sự thì phải tự chạy một DC mình toàn quyền → AD trên EC2.
  • AD Connector needs on-prem reachability (VPN/DX) too, but sets up no trust — it just forwards LDAP auth to on-prem. AD Connector cũng cần với tới on-prem (VPN/DX), nhưng không dựng trust — chỉ forward LDAP auth về on-prem.
  • Managed AD integrations: RDS for SQL Server, WorkSpaces, QuickSight, WorkDocs, Connect, and 3rd-party SaaS via SAML through AWS SSO. Managed AD tích hợp: RDS for SQL Server, WorkSpaces, QuickSight, WorkDocs, Connect, và SaaS bên thứ ba qua SAML nhờ AWS SSO.

Takeaway — the identity pieces at a glanceTakeaway — các mảnh identity nhìn một phát

One-line roleVai trò một dòng Calls STS?Gọi STS?
AD Identity database + authenticator (users, devices, passwords)Database identity + verify login (user, device, password) NoKhông
ADFS SAML IdP in front of AD → issues assertion so external apps accept the login (SSO)SAML IdP đứng trước AD → phát assertion để app ngoài chấp nhận login (SSO) No — the user trades the assertion at STSKhông — user cầm assertion gọi STS
AD Connector AWS proxy that forwards LDAP auth to on-prem AD — no SAML, nothing storedProxy AWS forward LDAP auth về on-prem AD — không SAML, không lưu gì No — the app/sign-in page doesKhông — app/sign-in page gọi
Simple AD Cheap standalone Samba directory — no trust, no MFA, no SQLDirectory Samba standalone rẻ — không trust, không MFA, không SQL NoKhông
AWS Managed AD A real Microsoft AD run by AWS in your VPC; can forest-trust on-prem. Federation to apps is via IAM Identity Center, not built in.AD Microsoft thật do AWS chạy trong VPC; forest-trust được on-prem. Federation ra app là nhờ IAM Identity Center, không tích hợp sẵn. NoKhông
IAM Identity Center The managed federation / SSO layer — the "new way" (org-wide portal + permission sets)Lớp federation / SSO managed — "new way" (portal org-wide + permission set) It brokers the temp credsNó môi giới cấp creds tạm
STS The exchange desk: token/assertion in → temp creds outQuầy đổi: token/assertion vào → creds tạm ra — (it is STS)— (nó là STS)
Two mix-ups to avoidHai chỗ hay lẫn ADFS ≠ AD Connector. ADFS = SAML federation to external apps; AD Connector = a proxy pipe to on-prem AD (no SAML). And Managed AD is just AD, not "AD + ADFS" — the SAML/SSO piece is a separate layer. In every flow, STS is called by the client / app / Cognito, never by the directory itself. ADFS ≠ AD Connector. ADFS = federation SAML ra app ngoài; AD Connector = ống proxy về on-prem AD (không SAML). Và Managed AD chỉ là AD, không phải "AD + ADFS" — phần SAML/SSO là lớp riêng. Trong mọi luồng, STS do client / app / Cognito gọi, không bao giờ do bản thân directory gọi.