Skip to main content
Skip to main content
Still in beta — questions, comments or suggestions? aramb@aramb.dev

MFA, Access Keys, and Temporary Credentials

Learn how Console, CLI, and SDK authentication works and how to choose the safest credential method for each.

15 min
Introductory
AWS Free TierFREE TIER

All services used in this lesson are covered by the AWS Free Tier.

AWS Services Used

IAMAlways freeIAM Identity CenterAlways free

How credentials work in AWS

Console sign-in usually features a password and MFA. Programmatic access uses either long-term access keys or preferred, temporary credentials.


Three ways people authenticate in AWS

MethodUsed forExpires?AWS guidance
Password + MFAConsole sign-in for humansSession-basedAlways enable MFA on human accounts
Access keysProgrammatic access via CLI and SDKNever — must be rotated manuallyAvoid where possible; high risk if leaked or forgotten
Temporary credentialsRoles, federation, workloadsYes — automaticallyStrongly preferred by the AWS Well-Architected Security pillar
Modern AWS authentication: console vs programmatic, old way vs modern way

What to use when

ContextUse thisWhy it's saferAvoid
AWS Console (human)Password + MFAStrong second factor on every sign-inUsing root for daily tasks
AWS CLI (human)IAM Identity Center (SSO) profileDelivers temporary credentials — no long-term keys on diskStoring permanent access keys in ~/.aws/credentials
App code running on AWSIAM role attached to the serviceTemporary credentials injected automatically, nothing to storeHardcoded keys in source code or config files
App code running outside AWSFederation or short-lived credentialsLimits blast radius if credentials are leakedShipping long-term keys to user devices or CI environments

Tip

Whenever you have a choice, pick temporary credentials. They expire on their own — so a leaked credential has a limited window of harm.


AWS CLI the modern way: Identity Center and single sign-on

AWS CLI can be configured to authenticate with IAM Identity Center so it retrieves credentials without you managing long-term keys.

SSO setup and login flow

0 / 3 completed

If you must use access keys

Sometimes you will encounter situations where access keys are still used. If that happens:

Hard rules — no exceptions

  • Do not create access keys for the root user
  • Do not put access keys in application code or commit them to a repository
  • Do not share access keys between people — each identity must have its own credentials

When you have no choice

Apply all of these — not just some:

  • Grant the minimum permissions required, nothing broader (least privilege)
  • Prefer temporary credentials wherever you can substitute them
  • If a key is exposed: deactivate it immediately, issue a replacement, and review CloudTrail for unauthorized activity

Micro-activity 1: Pick the right credential method

Practice
1 / 5

You are logging into the AWS Console as a student. Which credential method is best?


Micro-activity 2: Build your "learning account access plan"

My Learning Account Access Plan
0 / 5 filled

Fill this out before doing any AWS labs. Your answers are saved in your browser.


Summary

  • MFA is a best practice for securing interactive access
  • AWS recommends temporary credentials (roles, federation) over long-term access keys when possible
  • Root access keys are strongly discouraged
  • IAM Identity Center can configure AWS CLI authentication so the CLI retrieves credentials without you managing long-term keys

Quiz

Knowledge Check
1 / 10

MFA is best described as: