eks.access-entries.create

Give an IAM user, group or role an access entry

POST /eks/api/clusters/{cluster}/access-entriesIAM eks:CreateAccessEntryChanges state

policies associates access policies at once and also needs eks:AssociateAccessPolicy. A person also needs eks:AccessKubernetesApi in IAM to get a token.

Request syntax

POST /eks/api/clusters/{cluster}/access-entries
{
  "principalType": "enum",
  "principal": "string",
  "username": "string",
  "kubernetesGroups": "array of string",
  "policies": "array of json"
}

Path parameters

  • clusterRequired

    string

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

Request body

  • principalTypeRequired

    enum

    What `principal` names: user, group or role (IAM)

    One of: user, group, role

  • principalRequired

    string

    The IAM user name, group name or role name; 404 when none has it, 409 when it already has an entry on the cluster

    Constraints: 1-128 chars

  • usernameOptional

    string

    Kubernetes username the entry’s tokens carry, prefixed ews: by the cluster (RBAC sees ews:<username>); 1–100 letters, digits and : . _ @ -, not starting system:. Default: the IAM user name of whoever gets the token

    Constraints: 1-100 chars, /^[A-Za-z0-9][A-Za-z0-9:._@-]*$/

  • kubernetesGroupsOptional

    array of string

    Extra Kubernetes groups the entry’s tokens carry, for your own RBAC bindings; at most 20, each 1–100 letters, digits and : . _ @ -, not starting system: or ews:. Default none

    Constraints: 1-100 chars, /^[A-Za-z0-9][A-Za-z0-9:._@-]*$/

  • policiesOptional

    array of json

    Access policies to associate at once

Response

201 with the access entry and its policies: id, principalType, principalId, principalName, username, kubernetesGroups, policies (policy, namespaces, scope: cluster | namespaces), createdAt. 404 when no IAM principal of that type has the name; 409 when it already has an entry on the cluster 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:CreateAccessEntry 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 access-entries create cluster --principal-type user --principal example

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