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.
More on Global Infrastructure and IAM Basics
What is the difference between a Region, an Availability Zone and an edge location?BeginnerHow do you choose a Region for a workload?BeginnerWhat is the difference between an AZ name like `us-east-1a` and an AZ ID like `use1-az1`?IntermediateExplain the shared responsibility model.BeginnerWhat is the root user and how should you treat it?BeginnerWhat is the difference between an IAM user, group and role?Beginner