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.
Which identity service?
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.
| Identity | Service | Typical use |
|---|---|---|
| Employees | IAM Identity Center with external IdP | Console, SDK and tool access by group |
| Employees in AI apps | Trusted identity propagation | Permission-aware answers (Q Business) |
| Customers | Cognito user pools and API Gateway authorizers | Customer-facing AI applications |
| Clients needing AWS credentials | Cognito identity pools | Temporary credentials by group |
| Services | IAM roles | Lambda, 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
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.
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.