Training / Certifications / AWS Cloud Practitioner / IAM Roles, Federation and Identity Center

AWS Cloud Practitioner (CLF-C02) · Lesson 11 of 26

IAM Roles, Federation and Identity Center

Explain how IAM roles provide temporary credentials through AWS STS, where roles are used (applications on EC2, cross-account access, AWS services), and how federation and AWS IAM Identity Center give a workforce single sign-on, compared with Amazon Cognito and AWS Directory Service.

Domain 2: Security and Compliance (30%)Task 2.3About 5:40CaptionsStatic view for reduced motion
Lesson 11: IAM Roles, Federation and Identity Center Illustrative example: names are samples 1. IAM rolesPermissions with no passwordor access keys: temporarycredentials from AWS STS2. Federation, Identity CenterSign in once with a companyidentity and reach everyAWS account you needDomain 2, Task 2.3: AWS access management capabilitiesAccess keys in the codeKeys sit in code or on diskA leaked key works until revokedRotating means editing every serverA role insteadNo keys stored anywhereCredentials expire on their ownChange the role once, doneApps on AWS get access from a role, not from stored keysWho can assume itAn IAM usersame or another accountAn AWS servicesuch as EC2 or LambdaA federated userfrom a company directoryAnother rolerole chainingIAM roleno password,no access keysTrust policywho may assume itPermissions policywhat it can doA role is like a hat: whoever is trusted can wear it for a whileApp or userthe caller1. AssumeRoleAWS STSSecurity Token Servicechecks the trust policy2. returnsTemporary credentialsAccess key IDSecret access keySession tokenExpire after minutesto hoursWhen they expire, they stop working: nothing to rotate or revokeEC2 instancethe store's web appInstance profileholds role ShopAppRoleAmazon S3product imagesreads images, no keysAttach at launch or laterOne role per instanceCredentials auto-refreshNever store access keys on an EC2 instance: attach a roleCross-account accessAudit accountDana, auditorProduction accountRole:AuditReadOnlyassumeTrust policy names the audit accountService rolesA service assumes a role toact for you, such as Lambdawriting to DynamoDB.Service-linked roles arepredefined and owned bythe service itself.No shared passwords or keys between accountsEmployeeCompany directoryidentity provider (IdP)AWSassumes an IAM rolegets temporary credentials1. sign in2. SAML 2.0or OIDCNo IAM user per employeeOne place to add or remove peopleUsers sign in the way they already doAccess comes from rolesFederation: AWS trusts an outside identity providerIdentity sourceIdentity Centerdirectory, orActive Directory, orexternal IdP(SAML 2.0)IAM Identity CenterAWS access portal:one sign-inOrganizationsmanagement accountProductionPermission set: ReadOnlyDevelopmentPermission set: PowerUserShared servicesPermission set: AdminBusiness appsSAML single sign-onPermission set = a template of permissions that Identity Centerturns into roles in each assigned accountIAM Identity CenterYour workforceEmployees sign in onceto AWS accounts andbusiness appsAmazon CognitoYour app's customersSign-up and sign-infor web and mobileapps, social loginsAWS Directory ServiceManaged Microsoft ADActive Directory runby AWS, for AD-awareapps and WindowsWorkforce to AWS accounts: IAM Identity CenterCustomers of your app: Amazon CognitoIAM users only where federation can't workIf the question says……think“App on EC2 must reach S3 securely”Attach an IAM role“Temporary security credentials”IAM role via AWS STS“Access resources in another account”Cross-account IAM role“Use the existing corporate directory”Federation (SAML 2.0)“Single sign-on to many accounts”IAM Identity Center“Sign-in for a mobile app's users”Amazon Cognito“Managed Microsoft Active Directory”AWS Directory ServiceIAM rolesPermissions, no long-term keysTrust policy + permissionsAWS STS: credentials that expireEC2 apps, cross-account,services acting for youFederation, Identity CenterTrust an outside IdP(SAML 2.0 or OIDC)Identity Center: workforce SSOacross accounts, permission setsCognito: your app's customersPeople sign in once; apps and services borrowa role. Long-term keys are the exception.

Tip: turn your phone sideways or use full screen for larger labels.

Captions match the narration word for word. Press Space to play or pause and the arrow keys to change scenes.

Learning objective

Explain how IAM roles provide temporary credentials through AWS STS, where roles are used (applications on EC2, cross-account access, AWS services), and how federation and AWS IAM Identity Center give a workforce single sign-on, compared with Amazon Cognito and AWS Directory Service.

Exam mapping

Domain 2: Security and Compliance (30%). Task statement 2.3 in the official exam guide.

Key takeaways

  • An IAM role is an identity with permission policies but no long-term credentials (no password or access keys). Trusted principals assume it and receive temporary security credentials for a role session.
  • A role has a trust policy (who can assume it: users, roles, accounts, AWS services, federated users) and a permissions policy (what it can do).
  • AWS STS issues temporary credentials (access key ID, secret access key, session token) that last from minutes to hours and stop working when they expire, so there's nothing to rotate or revoke.
  • Apps on EC2 should use a role through an instance profile instead of stored access keys. Roles are also the primary way to grant cross-account access, and service roles let AWS services act for you.
  • Federation lets AWS trust an external identity provider (SAML 2.0 or OIDC), so people sign in with existing identities instead of IAM users.
  • IAM Identity Center is the recommended way to give a workforce single sign-on to multiple accounts in AWS Organizations, using permission sets. Amazon Cognito handles sign-in for your app's customers; AWS Directory Service provides managed Microsoft Active Directory.

Exam tips

How the exam asks about this

Questions describe a situation and expect you to recognize the concept behind it.

If the question mentions…Think
An application on EC2 needs to access S3 without storing credentialsAttach an IAM role (instance profile) to the instance
Short-term, automatically expiring credentialsIAM role, credentials issued by AWS STS
Give users in one AWS account access to resources in anotherCross-account IAM role with a trust policy
Employees should use their existing corporate identitiesIdentity federation (SAML 2.0) or IAM Identity Center
Central single sign-on to multiple accounts in AWS OrganizationsAWS IAM Identity Center with permission sets
Add sign-up and sign-in to a web or mobile app; managed Microsoft ADAmazon Cognito; AWS Directory Service

Common traps

  • Don't store access keys on an EC2 instance or in application code, even encrypted on disk. The exam answer is an IAM role attached to the instance.
  • A role has no password or access keys of its own. It isn't a group either: groups only collect users, while a role is assumed by whoever its trust policy allows.
  • IAM Identity Center is for your workforce (employees reaching AWS accounts and business apps); Amazon Cognito is for your application's end users. Older materials call Identity Center 'AWS Single Sign-On', its name until July 2022.
  • AWS Directory Service runs Microsoft Active Directory; it isn't the single sign-on service. Identity Center can use it as an identity source.

Practice

Exam-style questions

Answer each one before you open the explanation.

Question 1. An application running on an Amazon EC2 instance needs to read objects from an Amazon S3 bucket. What is the MOST secure way to give it access?

  1. Store an IAM user's access keys in the application's configuration file
  2. Use the root user's access keys in an environment variable
  3. Attach an IAM role with the needed S3 permissions to the instance
  4. Make the S3 bucket public so no credentials are needed
Show answer

C. Attach an IAM role with the needed S3 permissions to the instance. An IAM role attached through an instance profile gives the app temporary credentials that rotate automatically, with nothing stored on the instance. Access keys in a configuration file are tempting because they work, but they're long-term credentials that can leak and must be rotated by hand. Root keys and a public bucket break least privilege.

Question 2. Which statements about IAM roles are true? (Select TWO.)

  1. A role provides temporary security credentials when it is assumed
  2. A role has its own permanent password for console sign-in
  3. A role is a collection of IAM users who share permissions
  4. A role's trust policy defines who is allowed to assume it
  5. A role can only be used by AWS services, never by people
Show answer

A. A role provides temporary security credentials when it is assumed and D. A role's trust policy defines who is allowed to assume it. Assuming a role returns temporary credentials from AWS STS, and the trust policy lists the principals allowed to assume it. A collection of users that share permissions is tempting, but that's an IAM group. Roles have no long-term password, and both people (users, federated users) and services can assume them.

Question 3. A company has 40 AWS accounts in AWS Organizations. Employees should sign in once with their existing corporate credentials and reach the accounts they're assigned. Which service should it use?

  1. Amazon Cognito
  2. AWS IAM Identity Center
  3. An IAM user for each employee in every account
  4. AWS Directory Service alone
Show answer

B. AWS IAM Identity Center. IAM Identity Center provides workforce single sign-on to multiple accounts in AWS Organizations, using an external identity provider or Active Directory as the identity source and permission sets for access. Amazon Cognito is tempting because it handles sign-in, but it's for your application's customers. Creating IAM users in 40 accounts is what federation avoids.

Question 4. Which AWS service issues the temporary security credentials that are returned when a role is assumed?

  1. AWS Key Management Service (AWS KMS)
  2. Amazon Cognito user pools
  3. AWS Secrets Manager
  4. AWS Security Token Service (AWS STS)
Show answer

D. AWS Security Token Service (AWS STS). AWS STS generates temporary credentials (access key ID, secret access key and session token) for roles and federation. AWS Secrets Manager is tempting because it stores secrets, but it stores and rotates secrets you give it; it doesn't issue role credentials. AWS KMS manages encryption keys, and Cognito user pools issue tokens for app sign-in.

Question 5. A startup is building a mobile app and wants customers to sign up and sign in, including with their Google accounts. Which AWS service fits best?

  1. AWS IAM Identity Center
  2. AWS Directory Service
  3. IAM users with access keys
  4. AWS Organizations
  5. Amazon Cognito
Show answer

E. Amazon Cognito. Amazon Cognito provides sign-up and sign-in for web and mobile apps, with its own user directory and social identity providers such as Google. IAM Identity Center is tempting because it's about single sign-on, but it's for a company's workforce reaching AWS accounts and business apps, not for an app's customers. IAM users are for access to AWS itself, not app users.

Transcript

Lesson transcript

The full narration, scene by scene. The captions file contains the same text with timings.

Scene 1 · 0:00

Lesson 11: Roles and Identity Center. Welcome back to Domain 2, Security and Compliance, and task 2.3: access management. Last time, IAM users had long-term passwords and access keys. Today we cover two ideas that let you avoid them. First, IAM roles, which hand out temporary credentials. Second, federation and IAM Identity Center, which let our store's staff sign in once with a company identity and reach every AWS account they need.

Scene 2 · 0:29

The problem with long-term keys. The store's web app runs on a server and needs to read product images from S3. The quick fix is to paste an access key into the code. But keys in code or on disk get copied, and a leaked key keeps working until someone revokes it. Rotating it means editing every server. A role avoids all of that: nothing is stored, the credentials expire on their own, and you change permissions in one place.

Scene 3 · 1:01

What an IAM role is. An IAM role is an identity with permissions, but no password and no access keys. It isn't tied to one person; anyone trusted can assume it. A role has two policies. The trust policy says who may assume it: an IAM user, an AWS service such as EC2 or Lambda, a federated user, or another role. The permissions policy says what the role can do. Think of it as a hat you wear for a while.

Scene 4 · 1:34

Temporary credentials from AWS STS. Assuming a role is a request to the AWS Security Token Service, or STS. STS checks the role's trust policy, then returns temporary security credentials: an access key ID, a secret access key, and a session token. They last from minutes to hours, and when they expire, AWS no longer accepts them. There's nothing to rotate or revoke, and the caller can ask for fresh credentials while it's still allowed.

Scene 5 · 2:05

Roles for applications on EC2. Back to the web app. The store creates a role that can read the images bucket and attaches it to the EC2 instance through an instance profile, at launch or later. The app now gets temporary credentials from the instance automatically, and they refresh by themselves. An instance has one role at a time, shared by its apps. On the exam: never store access keys on an EC2 instance. Attach a role.

Scene 6 · 2:36

Cross-account and service roles. Roles also work across accounts. The store keeps production in one account, and its auditor, Dana, works in another. Production creates a role called AuditReadOnly whose trust policy names the audit account. Dana assumes it and gets read-only access, with no shared passwords or keys. Roles also let AWS services act for you: a service role lets Lambda write to DynamoDB, and service-linked roles are predefined and owned by a service.

Scene 7 · 3:07

Federation: bring your own identities. As the store grows, creating an IAM user for every employee gets messy. Federation fixes that. AWS trusts an outside identity provider, such as the company directory. An employee signs in there as usual, the provider vouches for them using SAML 2.0 or OpenID Connect, and AWS lets them assume a role with temporary credentials. There's no IAM user per person, and when someone leaves, the directory removes their access in one place.

Scene 8 · 3:39

IAM Identity Center. AWS recommends IAM Identity Center for workforce access. You enable it in your AWS Organizations management account and choose an identity source: its own directory, Active Directory, or an external identity provider. Staff sign in once to the AWS access portal and see every account and business app they're assigned. Admins assign permission sets, templates of permissions that Identity Center turns into roles in each account. Credentials are always short-term.

Scene 9 · 4:09

Who signs in where. Three services are easy to mix up. IAM Identity Center is for your workforce: employees reaching AWS accounts and business apps. Amazon Cognito is for your application's customers: sign-up and sign-in for web and mobile apps, including social logins like Google. AWS Directory Service runs Microsoft Active Directory for you, as AWS Managed Microsoft AD. And IAM users? Keep them for the rare cases where federation can't work, such as emergency access.

Scene 10 · 4:40

How the exam asks about this. Here's how the exam asks about this. An app on EC2 must reach S3 securely: attach an IAM role. Temporary security credentials: a role, issued by AWS STS. Access resources in another account: a cross-account role. Use the existing corporate directory: federation with SAML 2.0. Single sign-on to many accounts: IAM Identity Center. Sign-in for a mobile app's users: Amazon Cognito. Managed Microsoft Active Directory: AWS Directory Service.

Scene 11 · 5:10

Recap: roles, federation and Identity Center. To recap: a role carries permissions but no long-term credentials. Its trust policy says who can assume it, and AWS STS hands out credentials that expire. Use roles for apps on EC2, for cross-account access, and for services acting for you. Federation lets AWS trust your own identity provider, and IAM Identity Center gives your workforce single sign-on across accounts. Next, we'll protect the data itself with encryption and secrets.

Download captions (WebVTT)

Sources and accuracy

Checked against AWS documentation and the official CLF-C02 exam guide on October 18, 2026. AWS changes often, so confirm details in the current documentation. Diagrams and numbers in the animation are illustrative.

This free course is independent and isn't affiliated with or endorsed by Amazon Web Services. AWS and AWS Certified Cloud Practitioner are trademarks of Amazon.com, Inc. or its affiliates.

Preparing a team for AWS certification?

I run hands-on AWS training for teams, from Cloud Practitioner basics to architecture, built around your own environment.