eks.pod-identity-associations.create

Let pods of a service account act as an IAM role

POST /eks/api/clusters/{cluster}/pod-identity-associationsIAM eks:CreatePodIdentityAssociationChanges state

Also needs iam:PassRole on the role. Pods created afterwards get AWS_ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ENDPOINT_URL_STS/S3, so AWS SDKs work unchanged. 409 when the service account already has one.

Request syntax

POST /eks/api/clusters/{cluster}/pod-identity-associations
{
  "namespace": "string",
  "serviceAccount": "string",
  "role": "string"
}

Path parameters

  • clusterRequired

    string

    Constraints: /^(ewk-[0-9a-f]{12}|[a-z]([a-z0-9-]{0,38}[a-z0-9])?)$/

Request body

  • namespaceRequired

    string

    Namespace of the service account

    Constraints: /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/

  • serviceAccountRequired

    string

    Service account whose pods get the role

    Constraints: max 253 chars, /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/

  • roleRequired

    string

    Name of the IAM role the pods act as; needs iam:PassRole on it

    Constraints: 1-128 chars

Response

201 with the association: id, namespace, serviceAccount, roleId, roleName, createdBy, createdAt. 404 when no IAM role has the name; 403 without iam:PassRole on it; 409 for a cluster created before workload identity, when the service account already has one, or the quota is full. 404 when no cluster has that id or name, 403 without the permission on it.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow eks:CreatePodIdentityAssociation on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud eks pod-identity-associations create cluster --namespace example --service-account example --role example

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_eks_pod-identity-associations_create.