Lesson 1 of 4 Secure Access, GenAI Gateways and CI/CD

Federating Identities and Controlling Access to Models and Data

This lesson covers federation and role-based access control that use existing corporate and customer identities to decide who can use which models and data.

Learning outcomes

After completing this lesson, you will be able to:

  • Federate workforce identities with IAM Identity Center.
  • Authenticate customers with Amazon Cognito.
  • Apply role-based access control to models and knowledge bases.

Workforce identity federation

AWS IAM Identity Center connects to an external identity provider (such as Microsoft Entra ID or Okta) or its own directory and gives employees single sign-on to AWS accounts and applications through permission sets that map groups to IAM roles. Developers and data scientists receive temporary credentials for the roles their groups allow, so access to Bedrock models, knowledge bases and SageMaker AI follows directory group membership. Applications such as Amazon Q Business use trusted identity propagation to carry the user's identity to data sources, so answers respect each user's permissions.

Customer and application identities

Customer-facing generative AI applications must know who each user is, both to protect the application and to limit what each user can reach. Amazon Cognito user pools authenticate users, either directly or by federating with social and enterprise identity providers, and issue JSON Web Tokens (JWTs). Amazon API Gateway validates these tokens with a Cognito authoriser, a JWT authoriser or a Lambda authoriser, and passes claims such as the user ID and group memberships to the back end, which can use them to filter retrieval or apply per-user quotas.

For clients that call AWS services directly, Cognito identity pools exchange tokens for temporary AWS credentials, with roles mapped by group so that different users receive different permissions. Calls between services, such as a Lambda function invoking a model, use IAM roles rather than user credentials.

Match the pairs

Which identity service?

Exam skills 2.3.3

Match each identity need with the service that fits it.

Log in to try this activity Interactive activities are free with an account.

Role-based access control for models and data

Role-based access control (RBAC) maps groups to roles with specific permissions: analysts may invoke approved models and retrieve from the finance knowledge base; support staff may use the support agent alias only. Data access inside RAG needs care, because a knowledge base role can read all documents. The application must pass the user's groups and apply metadata filters on allowed groups during retrieval, or use separate knowledge bases per audience. Attribute-based access control (ABAC) with tags scales RBAC across many resources. The following table summarises identity options.

IdentityServiceTypical use
EmployeesIAM Identity Center with external IdPConsole, SDK and tool access by group
Employees in AI appsTrusted identity propagationPermission-aware answers (Q Business)
CustomersCognito user pools and API Gateway authorizersCustomer-facing AI applications
Clients needing AWS credentialsCognito identity poolsTemporary credentials by group
ServicesIAM rolesLambda, ECS and agents calling Bedrock

The following diagram shows a user's groups flowing into every retrieval call, so users retrieve only documents they may see.

Permission-aware retrieval. Employees sign in through the corporate identity provider, the backend reads their groups from the token, and every Retrieve call applies a metadata filter on the allowed_groups attribute that was tagged on each document at ingestion. Engineers therefore never receive finance chunks.
Separate knowledge bases per audience are the alternative to filtering.
Scenario questions

Permission-aware retrieval

Exam skills 2.3.3 · 3.2.1

Choose how to stop users seeing documents they are not allowed to read.

Log in to try this activity Interactive activities are free with an account.
Worked example

Permission-aware RAG

An internal assistant answers from HR, finance and engineering documents in one knowledge base. Engineers must not see finance documents. Employees sign in with the corporate identity provider.

Users authenticate through the identity provider (federated into Cognito or IAM Identity Center); the backend reads the user's groups from the token and applies a metadata filter on an allowed_groups attribute in every Retrieve call. Documents are tagged with allowed groups at ingestion.

Check yourself

Which service authenticates customers of a public generative AI application?

Show answer

Amazon Cognito user pools, used with an API Gateway authorizer.

Exam Tips

Remember for the exam

  • Workforce: IAM Identity Center federation with permission sets.
  • Customers: Cognito user pools with API Gateway authorizers.
  • Enforce document permissions in RAG with metadata filters on the user's groups.
  • Services use IAM roles, never long-term keys.