Black Friday sale: an extra 40% off every course until Monday, November 30.New Year sale: an extra 30% off every course until Friday, January 1.Memorial Day sale: an extra 25% off every course until Monday, May 31.SysAdmin Day sale: an extra 25% off every course until Sunday, August 1.Back to School sale: an extra 25% off every course until Sunday, August 22.Labor Day sale: an extra 25% off every course until Monday, September 6.Black Friday sale: an extra 40% off every course until Monday, November 29.New Year sale: an extra 30% off every course until Saturday, January 1.Choose your certification →

Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

3.3.1.6. Application Authentication and Authorization (Cognito, OAuth 2.0, Verified Permissions, EKS Pod Identity)

3.3.1.6. Application Authentication and Authorization (Cognito, OAuth 2.0, Verified Permissions, EKS Pod Identity)

💡 First Principle: Authentication proves who is calling; authorization decides what that caller may do. Use a managed identity provider for the first, keep the second in policy instead of scattered code, and give every workload its own short-lived credentials.

Amazon Cognito user pools as the OAuth 2.0 / OpenID Connect server: A user pool issues JWT ID, access and refresh tokens. Pick the grant by caller:

  • People in a web or mobile app: the authorization code grant with PKCE through managed login. The implicit grant is a legacy flow that exposes tokens in the browser.
  • Machine-to-machine (a partner back end, a batch job): the client credentials grant. Define a resource server with custom scopes (orders/read), give each calling system its own app client with a secret, and the client receives an access token that carries only its allowed scopes. Deleting or rotating one app client revokes one caller.
  • Enforcing tokens: an API Gateway Cognito user pool authorizer (REST APIs) or JWT authorizer (HTTP APIs) validates the token, and on REST methods can require specific OAuth scopes. An "ALB" listener rule with authenticate-cognito or authenticate-oidc signs users in before requests reach the targets.
  • Tokens are not AWS credentials. To let the client itself call S3 or DynamoDB, exchange the token in an identity pool for temporary IAM credentials (see 3.3.1).

Amazon Verified Permissions for fine-grained authorization: Coarse checks (is the user signed in, is she in the admins group, does the token carry orders/write) fit the authorizer. Rules that depend on the relationship between the user and the specific resource ("a clinician may read a record only for patients on her care team, unless the record is restricted") belong in "Verified Permissions": write them as Cedar policies in a policy store, use the user pool (or another OIDC provider) as the identity source, and have the application or an API Gateway Lambda authorizer call IsAuthorized / IsAuthorizedWithToken with the resource attributes. Policy changes need no code deployment, and each decision can be logged for audit. Encoding thousands of relationships as Cognito groups or token claims does not scale and goes stale until the next token refresh.

Pods that call AWS: EKS Pod Identity versus IRSA
EKS Pod IdentityIAM roles for service accounts (IRSA)
Setup per clusterInstall the Pod Identity Agent add-on (built into EKS Auto Mode); create a pod identity association (cluster, namespace, service account, role)Create an IAM OIDC provider for the cluster's issuer URL
Role trust policyTrusts the single service principal pods.eks.amazonaws.com (sts:AssumeRole, sts:TagSession), so the same role works in every cluster unchangedNames each cluster's OIDC provider and service account, so every new cluster means editing each role
ABACAdds session tags such as cluster name, namespace and service accountConditions on the token's sub and aud claims
Cross-accountAssociation can name a target role in another account; EKS chains the role assumptionTrust the cluster's OIDC provider from the other account
Where it runsEKS on Linux EC2 nodes only (not Fargate, Windows nodes, Outposts, EKS Anywhere or self-managed Kubernetes)Also works on Fargate and with any OIDC-capable Kubernetes

Either way, each pod receives credentials only for its own service account's role. Block pod access to the node's instance metadata (IMDSv2 with a hop limit of 1) so a pod cannot fall back to the node role, which often has broader permissions.

⚠️ Exam Trap: "Use the node group's instance role" or "mount an IAM user's access key as a Kubernetes secret" are never the least-privilege answer for pods. Separate teams' applications on shared nodes need per-service-account roles through Pod Identity or IRSA.

See how it connects
Alvin Varughese
Written byAlvin Varughese
Founder•26 professional certifications earned