Workload identity on Amazon EKS with Pod Identity

Practical guide to IAM agent and workload identity on Amazon EKS: SPIFFE with Pod Identity to separate, authorize and audit each pod that shares a role.

CloudScript Technology
December 2, 20268 min read
Workload identity on Amazon EKS with Pod Identity

Workload identity on Amazon EKS now has native support: IAM launched, in preview, agent and workload identity, and EKS delivers it through Pod Identity. The feature appears in the AWS announcement about more ambitious agents, but the problem it solves is old and not limited to AI: when several pods use the same role, AWS sees the role, not who used it.

This guide explains the concept, when it is worth adopting, how to enable it and what to avoid while the feature is in preview.

What it is

An IAM role says what a caller can do, not who it is. Several workloads can share a role, and one workload can use several. The IAM documentation sums it up: the identity is added to the role session and does not replace it. The role still defines the permissions; the identity says which workload is using the role.

Main pieces:

  • Provider: the issuer and the trust boundary. It has a SPIFFE or NONE scheme and, for SPIFFE, a trust domain (for example, corp.example.com). It can be created at account or organization scope, and the scheme cannot change after creation.
  • Template: defines part of the namespace (for example, retail/payments) and a pattern that builds each workload's name from attested facts.
  • Attestation policy: says which AWS service can vouch for the workload and which facts must match. Without it, no identity is issued.

On EKS, AWS STS evaluates the facts Pod Identity reports about the pod and, if they match the policy, includes the identity in the role session. Outside AWS, the same workload presents itself with a JWT-SVID or an X.509-SVID, documents from the SPIFFE standard. Any SPIFFE- or OIDC-compatible service can verify them without AWS credentials. The credentials are short-lived and rotated automatically.

If you use the SDK, nothing changes: on EKS, the default Pod Identity credentials already carry the identity, and the AWS SDKs use them without code changes. The Pod Identity Agent is what requests the SVIDs.

How to choose: IRSA, Pod Identity or Pod Identity with workload identity

EKS offers two ways to grant IAM permissions to pods: IRSA and Pod Identity.

  • IRSA: uses one OIDC provider per cluster and AssumeRoleWithWebIdentity. It is still supported and assumes roles in other accounts directly. It does not have the new workload identity.
  • Pod Identity: an association made through the EKS API, with an agent on each node delivering the credentials. It needs no per-cluster OIDC provider and supports session tags to reuse a role across service accounts.
  • Pod Identity with workload identity (preview): everything Pod Identity already does, plus a verifiable SPIFFE name per workload, which shows up in policies and in CloudTrail.

Workload identity is worth enabling when:

  1. several pods share the same role and you need to audit or restrict each one;
  2. you want mutual authentication (mTLS) between services with short-lived certificates;
  3. the workload needs to authenticate to your own or third-party APIs without storing secrets.

If each application already has its own role and only accesses AWS, plain Pod Identity, with one service account per application, as the EKS best practice recommends, may be enough.

Step by step

The examples use fictitious names (prod-cluster-1, account 111122223333, domain corp.example.com). Do this first on a test cluster.

1. Make sure Pod Identity is working

The cluster needs the EKS Pod Identity Agent (EKS Auto Mode already includes it) and an association between a role and a service account:

aws eks create-addon \
  --cluster-name prod-cluster-1 \
  --addon-name eks-pod-identity-agent

aws eks create-pod-identity-association \
  --cluster-name prod-cluster-1 \
  --namespace payments \
  --service-account payments-api \
  --role-arn arn:aws:iam::111122223333:role/payments-api-role

aws eks list-pod-identity-associations \
  --cluster-name prod-cluster-1 \
  --namespace payments

Keep the associationId returned by the last call.

2. Create the SPIFFE provider and the template in IAM

In the IAM console, create a provider with the SPIFFE scheme and your trust domain. If you use AWS Organizations, a provider at organization scope gives every account the same naming structure, and the provider policy distributes the path prefixes among member accounts.

Then create the template for the cluster: define the path prefix, the pattern that builds the pod name and the attestation policy that accepts EKS as the attesting service. The condition keys available for each fact are in Write attestation policies. Choose the granularity: the identity can cover a service account or something finer.

The role trust policy does not change: STS adds the identity to the session the service already assumes.

3. Enable the identity on the Pod Identity association

Point the association to the template and the provider with workloadIdentityConfig. You can also enable it through the console, the EKS API or CloudFormation:

aws eks update-pod-identity-association \
  --cluster-name prod-cluster-1 \
  --association-id <association-id> \
  --workload-identity-config '{
    "enabled": true,
    "templateArn": "arn:aws:iam::111122223333:workload-identity-template/eks-prod-1",
    "providerArn": "arn:aws:iam::111122223333:workload-identity-provider/payments-prod"
  }'

Associations are eventually consistent: the change may take a few seconds to take effect.

4. Restart the pods

Pod Identity configures the pod when it is created, so pods that are already running do not receive the identity. Run a rollout restart:

kubectl rollout restart deployment/payments-api -n payments
kubectl rollout status deployment/payments-api -n payments

5. Reference the identity in the resource policy

Sessions with workload identity carry the aws:OriginIdentity/* keys. aws:OriginIdentity/Subject holds the workload identifier. The example below, in an S3 bucket policy, denies reads to anyone using the shared role who is not the reporting workload:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "SomenteWorkloadDeRelatorios",
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::example-payments-reports/*",
      "Condition": {
        "ArnEquals": {
          "aws:PrincipalArn": "arn:aws:iam::111122223333:role/shared-app-role"
        },
        "StringNotEquals": {
          "aws:OriginIdentity/Subject": "<identificador-do-workload>"
        }
      }
    }
  ]
}

Copy the exact identifier value from a real CloudTrail event (step 6) before applying the policy, so you do not block the right workload.

6. Check in CloudTrail

CloudTrail records the identity when the role session is created and writes the context into the userIdentity element of events, according to the AWS Security Blog. For a quick check, use lookup-events:

aws cloudtrail lookup-events \
  --lookup-attributes AttributeKey=EventName,AttributeValue=GetObject \
  --max-results 5 \
  --query 'Events[].CloudTrailEvent' --output text

Look for the workload identifier inside userIdentity in the JSON. If it does not appear, review the attestation policy and confirm the pod was recreated.

Best practices

Security: least privilege still applies

The identity says who made the call; it does not reduce what the role allows. Keep the role to the minimum required, as the IAM best practices recommend, and use the identity to restrict further on sensitive resources.

Security: close the path to the node role

If IMDS is not restricted, containers can reach the node role credentials. Restrict access to IMDS so a pod cannot escape its identity by using the node credentials.

Scale: one provider per organization

A provider at organization scope standardizes names across all accounts. The identity follows role chaining into other accounts in the same organization, but does not pass to a role in another organization.

Cost: watch X.509

The identity has no additional charge during the preview. If you turn on an AWS Private CA to issue X.509-SVIDs, the charges for the CA and the issued certificates go to your account. If the use case only needs JWT-SVID, evaluate before enabling X.509.

Operations: treat it as preview

IAM warns that the feature is in preview and subject to change. Version the configuration in IaC, test outside production and follow the documentation before depending on it in critical flows.

Common mistakes

  • Putting a preview feature into critical production without a rollback plan.
  • Trusting the identity and leaving the role broad. If the resource policy does not reference the identity, the broad role still applies to every pod.
  • Forgetting to restart the pods after enabling workloadIdentityConfig.
  • Creating the template without an attestation policy: no identity is issued.
  • Ignoring the region: on EKS, the feature is available in commercial regions, except Middle East (Bahrain) and Middle East (UAE).
  • Leaving old credentials in the pod: credentials that come earlier in the SDK chain are still used, even with the association in place.

Frequently asked questions

Do I need to change the application code?
For calls to AWS, no: the SDKs use the Pod Identity credentials, which already carry the identity. To authenticate outside AWS with JWT-SVID or X.509-SVID, the application or the proxy needs to present those documents to the target service.

Does it work with IRSA?
On EKS, the documented delivery is through Pod Identity. If you use IRSA and want workload identity, you need to plan the migration to Pod Identity.

Does the identity replace the role?
No. The role defines the permissions and the identity says which workload is using the role. They complement each other.

Conclusion

Workload identity on Amazon EKS fixes an old blind spot: knowing which pod made each call when many share a role, and using that information in policies, auditing and secretless authentication. Since the feature is still in preview, the sensible path is to test on an isolated cluster, keep least privilege on roles and track cost and regions.

If your team wants to review its IAM strategy on Kubernetes, migrate from IRSA to Pod Identity or design the identity of its workloads and agents, talk to CloudScript. See also how we work with Kubernetes and AWS and, if you are getting started, the guide Kubernetes: what it is and how it works.


Sources

Amazon Web Services, AWS, Amazon EKS, AWS IAM, AWS CloudTrail and AWS Private CA are trademarks of Amazon.com, Inc. or its affiliates. Kubernetes and SPIFFE are trademarks of The Linux Foundation. Trademarks are cited only to identify the technologies.

Stay up to date

Get our articles on DevOps, Kubernetes, Platform Engineering and Cloud Native delivered to your inbox.

No spam. Unsubscribe anytime.

CloudScript is a Platform Engineering company focused on enterprise-grade cloud-native application architecture.

No spam. Unsubscribe anytime.
Follow us

24/7 support for contracted clients via OpsScript.

© 2026 CloudScript Technology. All rights reserved.