Application identity and authorization
Amazon Cognito user pools and identity pools, guest access and token types, API Gateway authorizers, Amazon Verified Permissions with Cedar, and choosing RBAC or ABAC for application users.
Exam tasks: 4.1 (Skills 4.1.1 identity for application users with Amazon Cognito, 4.1.3 troubleshooting Cognito), 4.2 (Skills 4.2.1 Amazon Verified Permissions, 4.2.2 ABAC and RBAC strategies)
The decision: does your application's user need to sign in (a user pool), call AWS directly with credentials (an identity pool), or be authorized against your own resources with fine-grained rules (Verified Permissions), and where is each check enforced?
The moving parts
User pools vs identity pools
| User pool | Identity pool | |
|---|---|---|
| Job | Authentication: a user directory and OIDC/OAuth 2.0 provider | Credential vending: swaps a token for temporary AWS credentials |
| Output | JWTs: ID, access and refresh tokens | An access key, secret and session token for an IAM role |
| Federates with | Social IdPs, SAML, OIDC | User pools, social IdPs, SAML, OIDC, your own backend (developer authenticated) |
| Guest users | No | Yes, unauthenticated identities with their own role |
| Use when | Users sign in to your app or API | The app calls S3, DynamoDB, IoT and so on directly |
- Token types: the ID token carries user attributes (who the user is). The access token carries scopes and groups (what the app may call), and is the one to send to APIs. The refresh token gets new ones. You can revoke refresh tokens, and access tokens issued from them stop working at Cognito endpoints.
- Machine-to-machine: the client credentials grant with resource server scopes issues access tokens to services, no user involved.
- Feature plans: Lite, Essentials (the default for new pools) and Plus. Threat protection (compromised credential checks, adaptive authentication that scores risky sign-ins and can require MFA or block) is in Plus. Passkeys, email MFA and access token customization need Essentials or Plus.
Legacy: use User pool threat protection (Plus plan) instead
"Advanced security features" in Cognito were folded into the Essentials and Plus feature plans. Compromised credential detection and adaptive authentication now come with the Plus plan.
Identity pools in detail
- Each identity is authenticated or unauthenticated (guest), and each type maps to an IAM role. Keep the
guest role tiny, for example
PutObjectto one upload prefix. - Role selection: a default role, rules that map a token claim to a role, or the
cognito:preferred_roleclaim from user pool groups. - Attributes for access control: map token claims to principal tags, then write ABAC policies such as "only
objects under
users/${aws:PrincipalTag/sub}/". - Role trust policies must trust
cognito-identity.amazonaws.comand pincognito-identity.amazonaws.com:audto your identity pool ID andamrtoauthenticatedorunauthenticated. - The enhanced flow is the default. The basic (classic) flow lets the client call
AssumeRoleWithWebIdentityitself and bypasses role rules, so leave it off unless you need it.
A guest role with broad access
Unauthenticated identities are available to anyone who has the identity pool ID, which ships in your app. A guest
role with s3:* on a bucket is a public bucket. Scope it to the minimum, or turn off guest access.
API Gateway authorizers
| Authorizer | Checks | Good for |
|---|---|---|
| IAM (SigV4) | The caller signed with AWS credentials allowed to execute-api:Invoke | Service-to-service, identity pool users |
| Cognito user pool (REST) | A valid user pool token, optional scopes | Straightforward sign-in-then-call |
| JWT authorizer (HTTP APIs) | Any OIDC issuer's JWT, audience and scopes | Cognito or third-party IdPs on HTTP APIs |
| Lambda authorizer | Whatever your code decides, returning an IAM policy | Custom tokens, calls to Verified Permissions, legacy auth |
| Resource policy (REST) | Source account, IP, VPC endpoint | Private APIs, IP allow-lists, cross-account |
- Mutual TLS on a custom domain authenticates clients by certificate, in addition to any authorizer.
- Cache Lambda authorizer results carefully: a cached allow for one path can be reused for others with the same token if the returned policy is too broad.
Amazon Verified Permissions
- A managed policy decision point for your own applications. Policies are written in Cedar and stored in a policy store with a schema of principals, actions and resources.
- Your app, or an API Gateway Lambda authorizer that Verified Permissions can generate, calls
IsAuthorized,IsAuthorizedWithToken(passing a Cognito or OIDC token from an identity source) orBatchIsAuthorized. - Default deny, and a
forbidalways beats apermit. The same shape as IAM, applied to your app's objects. - Policy templates let you create per-resource grants ("share this document with Priya") without writing a new policy by hand.
- Every decision can be logged, which answers "who could see patient record 88?" for auditors.
permit (
principal in Clinic::Role::"nurse",
action in [Clinic::Action::"viewChart"],
resource
)
when { resource.ward == principal.ward };RBAC or ABAC
| RBAC | ABAC | |
|---|---|---|
| Grants based on | The role or group the user is in | Attributes (tags, claims) of the user and the resource |
| New project or team | New role, new policy | Tag the resources, nothing else |
| Policy count | Grows with teams | Stays small |
| Audit question | "Who is in the admins role?" is easy | "Who can reach this resource?" needs attribute analysis |
| In AWS | Permission sets, IAM roles, Cognito groups | aws:PrincipalTag vs aws:ResourceTag, Cedar when clauses on attributes |
- Most real designs mix both: a role decides the kind of access, attributes decide which resources.
- ABAC depends on tag integrity. Control who can set tags (
aws:RequestTag,aws:TagKeys, tag policies) or users can grant themselves access.
Exam signal
"Permissions must scale as new teams and projects are added without policy changes" means ABAC. "Fine-grained, per-record permissions inside a custom application, managed centrally and outside the code" means Verified Permissions.
Scenarios
An identity pool is what turns a user into AWS credentials, and separate guest and authenticated roles with per-user prefixes keep each identity to its own data. S3 doesn't accept Cognito JWTs directly. An embedded access key is a shared long-term secret. One role for both identity types gives guests upload rights.
Verified Permissions externalizes application authorization, supports forbid rules that override permits (legal hold), and logs decisions. IAM authorizes AWS API calls, not the service's own document operations. Cognito groups are coarse roles without resource rules, and API Gateway resource policies filter callers by account or network, not by document attributes.
When a route requires authorization scopes, only an access token can satisfy it, because ID tokens don't carry scopes. HTTP API JWT authorizers work with Cognito. No identity pool or SigV4 is involved here. Token issuance for APIs is available on every feature plan.
Further reading
Temporary credentials and STS
Choosing the right AWS STS API, external IDs against the confused deputy, session policies, tags and source identity, IAM Roles Anywhere, presigned URLs, access key hygiene and centralized root access.
Policy evaluation logic
How AWS combines identity, resource, boundary, session, SCP and RCP policies into one allow or deny, how cross-account requests differ, and the condition keys and operators the exam leans on.