Interview Prep/AWS/Global Infrastructure and IAM Basics

How does MFA work in IAM and how do you enforce it?

IntermediateConceptGlobal Infrastructure and IAM Basics
Answer

IAM supports virtual TOTP apps, FIDO2 security keys/passkeys and hardware TOTP tokens. You enforce it with a policy that denies everything except MFA self-management when aws:MultiFactorAuthPresent is false.

{"Effect":"Deny","NotAction":["iam:*MFADevice*","iam:ListVirtualMFADevices","sts:GetSessionToken"],
 "Resource":"*",
 "Condition":{"BoolIfExists":{"aws:MultiFactorAuthPresent":"false"}}}

BoolIfExists matters: requests from roles or keys without MFA context would otherwise slip past a plain Bool. With Identity Center, enforce MFA in the identity source instead.

aws All AWS questions Roadmap: AWS core services

More on Global Infrastructure and IAM Basics