Root user, MFA and passwords
Protect the root user, require strong passwords, and add a second factor to every sign-in.
What it is
Anyone who signs in to the account can change settings or delete resources. Three controls make sign-ins safer:
- Locking away the root user, the one identity that can do everything.
- An account password policy that forces IAM users to choose strong passwords.
- Multi-factor authentication (MFA): something the user knows (a password) plus something the user has (a phone app or a security key).
The main benefit of MFA: if a password is stolen, the account is still safe, because the attacker doesn't have the user's device.
The root user
The root user is created with the account and signs in with the account's email address and password. Its permissions can't be limited by IAM policies, so treat it like the master key to a building:
- Don't use it for daily work. Create an IAM user or use IAM Identity Center instead.
- Give it a long, unique password and turn on MFA.
- Don't create access keys for it.
A short list of tasks needs the root user, for example:
- Changing the account's email address, root password or account name, and closing or reopening the account.
- Restoring access when the only IAM administrator has locked themselves out.
- Turning on IAM user access to the Billing console, and viewing some tax invoices.
- Turning on MFA Delete on an S3 bucket.
- Editing or deleting an S3 bucket policy or SQS queue policy that denies every principal, including admins.
- Signing up as a seller in the EC2 Reserved Instance Marketplace.
Updated since the slides
AWS now enforces MFA for root users of every account type (standalone, management and member accounts): the root user is asked to add it at account creation or at sign-in. With AWS Organizations, centralized root access can also be turned on: the management account removes root credentials from member accounts entirely, and new member accounts are created with no root password at all. Privileged tasks such as unlocking a misconfigured bucket policy are then done centrally.
Password policy
A password policy sets rules for IAM users' passwords. It doesn't apply to the root user or to access keys.
If no policy is set, AWS's default applies: at least 8 characters, at least three of the four character types (uppercase, lowercase, numbers, symbols), not the same as the account name or email, and no expiry.
A custom policy can:
- Set a minimum length from 6 to 128 characters.
- Require uppercase letters, lowercase letters, numbers and symbols.
- Let users change their own password.
- Make passwords expire after 1 to 1,095 days, and optionally require an administrator to reset an expired one.
- Stop users reusing their last 1 to 24 passwords.
IAM has no account lockout setting: repeated wrong passwords don't lock a user out.
MFA
With MFA turned on, signing in takes the password and a code or tap from a device the user owns.
MFA device types
- Passkeys and security keys (FIDO2). A hardware key such as a YubiKey, or a passkey synced through a phone or password manager. The user taps or approves instead of typing a code. Resistant to phishing.
- Virtual authenticator apps. An app such as Google Authenticator, Microsoft Authenticator or Authy shows a six-digit code that changes every 30 seconds. One app can hold codes for many accounts.
- Hardware TOTP tokens. A small key fob with a screen that shows a six-digit code. Special versions exist for AWS GovCloud (US).
Each root user or IAM user can register up to 8 MFA devices, in any mix. Registering two is a good idea, so losing one doesn't lock the user out.
Updated since the slides
The slides call security keys "U2F". AWS now supports the newer FIDO2 standard, including synced passkeys. AWS has also ended support for SMS text-message MFA.
Requiring MFA for actions
A policy can be made to work only when the caller signed in with MFA, using the condition key aws:MultiFactorAuthPresent. This is covered with other conditions. For example, a policy can allow stopping or terminating EC2 instances only for users who signed in with MFA.
Real-world examples
- A bank requires a 14-character minimum, all four character types, 90-day expiry and no reuse of the last 24 passwords, to match its security standard.
- A start-up gives every admin a YubiKey and registers a second key kept in a safe, so the root user can always be recovered.
Exam tips
- "Protect the root user" → strong password, MFA, no access keys, don't use it day to day.
- "Stolen password must not be enough to sign in" → MFA.
- "Require users to use strong passwords / rotate them" → IAM password policy.
- "Only allow an action if the user signed in with MFA" → condition
aws:MultiFactorAuthPresent. - "Which task needs the root user?" → account settings (email, closing the account), S3 MFA Delete, restoring a locked-out admin, Billing access for IAM users.
Common traps
- "Use the root user with MFA for daily admin work." MFA makes root safer, but root still shouldn't be used day to day.
- "A password policy also protects access keys." It only covers IAM users' console passwords.
- "SMS MFA is an option." It's no longer supported for new set-ups.
Hands-on lab: protect your sign-ins
Goal: set a password policy, then add MFA to the root user and to your IAM user.
Free
IAM and MFA have no charge. An authenticator app is free; a hardware key is optional.
Before you start: install an authenticator app on your phone, or have a security key ready. Sign in as your IAM admin user from the previous lab.
Set a password policy
Open IAM → Account settings → Password policy → Edit. Choose Custom and set: minimum length 14, all four character types, allow users to change their own password, prevent reuse of 5 passwords. Save.
Add MFA to your IAM user
Open IAM → Users → your user → Security credentials → Assign MFA device. Give it a name, choose Authenticator app (or Passkey or security key), and follow the prompts: scan the QR code and enter two codes in a row.
Test it
Sign out and sign back in. After your password, you're asked for the MFA code.
Add MFA to the root user
Sign in as root (email address). Open the account menu → Security credentials → Assign MFA device, and register a device the same way. Sign out of root afterwards.
Expected result: both your IAM user and the root user ask for MFA at sign-in, and new IAM users must meet your password policy.
Clean up: nothing to remove. Keep MFA turned on.