soft guideINFRASTRUCTURE & ADVISORY

Note 10

One IAM role for every service, and no neighbour's secrets

EKS Pod Identity session tags turn one shared role into per-service permissions: a pod reads only the secrets, tables and buckets under its own namespace and service account.

The IAM sprawl problem

A role per service means a Terraform change for every new service, dozens of near-identical policies, and the steady temptation to reuse one role for "just this other service".

Session tags do the scoping

EKS Pod Identity tags every session with the pod's namespace and service account. One shared application role can then use those tags in resource paths:

statement {
  sid     = "OwnSecretsOnly"
  actions = ["secretsmanager:GetSecretValue"]
  resources = [
    "arn:aws:secretsmanager:${region}:${account}:secret:${cell}/services/$${aws:PrincipalTag/kubernetes-namespace}/$${aws:PrincipalTag/kubernetes-service-account}/*"
  ]
}

A pod in payments running as api reads <cell>/services/payments/api/* and nothing else. Tables and buckets follow the same prefix rule. A label change cannot widen it: the tags come from the platform, not from the pod.

Where it stops

Start a conversation

Bring your infrastructure
into focus.

Tell me what you are building, operating, or trying to improve.

Let’s talk