CreateAccessEntry
Creates an access entry.
An access entry allows an IAM principal to access your cluster. Access
entries can replace the need to maintain entries in the aws-auth
ConfigMap
for authentication. You have the following options for
authorizing an IAM principal to access Kubernetes objects on your cluster: Kubernetes
role-based access control (RBAC), Amazon EKS, or both. Kubernetes RBAC authorization
requires you to create and manage Kubernetes Role
, ClusterRole
,
RoleBinding
, and ClusterRoleBinding
objects, in addition
to managing access entries. If you use Amazon EKS authorization exclusively, you
don't need to create and manage Kubernetes Role
, ClusterRole
,
RoleBinding
, and ClusterRoleBinding
objects.
For more information about access entries, see Access entries in the Amazon EKS User Guide.
Request Syntax
POST /clusters/name
/access-entries HTTP/1.1
Content-type: application/json
{
"clientRequestToken": "string
",
"kubernetesGroups": [ "string
" ],
"principalArn": "string
",
"tags": {
"string
" : "string
"
},
"type": "string
",
"username": "string
"
}
URI Request Parameters
The request uses the following URI parameters.
- name
-
The name of your cluster.
Required: Yes
Request Body
The request accepts the following data in JSON format.
- clientRequestToken
-
A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
Type: String
Required: No
- kubernetesGroups
-
The value for
name
that you've specified forkind: Group
as asubject
in a KubernetesRoleBinding
orClusterRoleBinding
object. Amazon EKS doesn't confirm that the value forname
exists in any bindings on your cluster. You can specify one or more names.Kubernetes authorizes the
principalArn
of the access entry to access any cluster objects that you've specified in a KubernetesRole
orClusterRole
object that is also specified in a binding'sroleRef
. For more information about creating KubernetesRoleBinding
,ClusterRoleBinding
,Role
, orClusterRole
objects, see Using RBAC Authorization in the Kubernetes documentation. If you want Amazon EKS to authorize the
principalArn
(instead of, or in addition to Kubernetes authorizing theprincipalArn
), you can associate one or more access policies to the access entry usingAssociateAccessPolicy
. If you associate any access policies, theprincipalARN
has all permissions assigned in the associated access policies and all permissions in any KubernetesRole
orClusterRole
objects that the group names are bound to.Type: Array of strings
Required: No
- principalArn
-
The ARN of the IAM principal for the
AccessEntry
. You can specify one ARN for each access entry. You can't specify the same ARN in more than one access entry. This value can't be changed after access entry creation.The valid principals differ depending on the type of the access entry in the
type
field. The only valid ARN is IAM roles for the types of access entries for nodes:. You can use every IAM principal type for
STANDARD
access entries. You can't use the STS session principal type with access entries because this is a temporary principal for each session and not a permanent identity that can be assigned permissions.IAM best practices recommend using IAM roles with temporary credentials, rather than IAM users with long-term credentials.
Type: String
Required: Yes
-
Metadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don't propagate to any other cluster or AWS resources.
Type: String to string map
Map Entries: Maximum number of 50 items.
Key Length Constraints: Minimum length of 1. Maximum length of 128.
Value Length Constraints: Maximum length of 256.
Required: No
- type
-
The type of the new access entry. Valid values are
Standard
,FARGATE_LINUX
,EC2_LINUX
, andEC2_WINDOWS
.If the
principalArn
is for an IAM role that's used for self-managed Amazon EC2 nodes, specifyEC2_LINUX
orEC2_WINDOWS
. Amazon EKS grants the necessary permissions to the node for you. If theprincipalArn
is for any other purpose, specifySTANDARD
. If you don't specify a value, Amazon EKS sets the value toSTANDARD
. It's unnecessary to create access entries for IAM roles used with Fargate profiles or managed Amazon EC2 nodes, because Amazon EKS creates entries in theaws-auth
ConfigMap
for the roles. You can't change this value once you've created the access entry.If you set the value to
EC2_LINUX
orEC2_WINDOWS
, you can't specify values forkubernetesGroups
, or associate anAccessPolicy
to the access entry.Type: String
Required: No
- username
-
The username to authenticate to Kubernetes with. We recommend not specifying a username and letting Amazon EKS specify it for you. For more information about the value Amazon EKS specifies for you, or constraints before specifying your own username, see Creating access entries in the Amazon EKS User Guide.
Type: String
Required: No
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"accessEntry": {
"accessEntryArn": "string",
"clusterName": "string",
"createdAt": number,
"kubernetesGroups": [ "string" ],
"modifiedAt": number,
"principalArn": "string",
"tags": {
"string" : "string"
},
"type": "string",
"username": "string"
}
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- accessEntry
-
An access entry allows an IAM principal (user or role) to access your cluster. Access entries can replace the need to maintain the
aws-auth
ConfigMap
for authentication. For more information about access entries, see Access entries in the Amazon EKS User Guide.Type: AccessEntry object
Errors
For information about the errors that are common to all actions, see Common Errors.
- InvalidParameterException
-
The specified parameter is invalid. Review the available parameters for the API request.
HTTP Status Code: 400
- InvalidRequestException
-
The request is invalid given the state of the cluster. Check the state of the cluster and the associated operations.
HTTP Status Code: 400
- ResourceInUseException
-
The specified resource is in use.
HTTP Status Code: 409
- ResourceLimitExceededException
-
You have encountered a service limit on the specified resource.
HTTP Status Code: 400
- ResourceNotFoundException
-
The specified resource could not be found. You can view your available clusters with
ListClusters
. You can view your available managed node groups withListNodegroups
. Amazon EKS clusters and node groups are AWS Region specific.HTTP Status Code: 404
- ServerException
-
These errors are usually caused by a server-side issue.
HTTP Status Code: 500
Examples
In the following example or examples, the Authorization header contents
(AUTHPARAMS
) must be replaced with an AWS Signature Version 4
signature. For more information about creating these signatures, see Signature
Version 4 Signing Process in the Amazon EKS General
Reference.
You need to learn how to sign HTTP requests only if you intend to manually
create them. When you use the AWS Command Line
Interface (AWS CLI)
Example
The following example creates an access entry for an IAM role
with the name my-role
. Since a type
isn't specified,
it's created as type Standard
. Since a username
isn't
specified, Amazon EKS sets the value for username
.
Sample Request
POST /clusters/my-cluster/access-entries HTTP/1.1
Host: eks.us-west-2.amazonaws.com
Accept-Encoding: identity
User-Agent: aws-cli/2.9.0 Python/3.9.11 Windows/10 exe/AMD64 prompt/off command/eks.create-access-entry
X-Amz-Date: 20230530T193227Z
Authorization: AUTHPARAMS
Content-Length: 120
{
"principalArn": "arn:aws:iam::012345678910:role/my-role",
"clientRequestToken": "5a8578bd-b6c1-4624-9e65-d0b70f857835"
}
Sample Response
HTTP/1.1 200 OK
Date: Tue, 30 May 2023 19:32:43 GMT
Content-Type: application/json
Content-Length: 485
x-amzn-RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: *,Authorization,Date,X-Amz-Date,X-Amz-Security-Token,X-Amz-Target,content-type,x-amz-content-sha256,x-amz-user-agent,x-amzn-platform-id,x-amzn-trace-id
x-amz-apigw-id: FwFUDEhlPHcF4WQ=
Access-Control-Allow-Methods: GET,HEAD,PUT,POST,DELETE,OPTIONS
Access-Control-Expose-Headers: x-amzn-errortype,x-amzn-errormessage,x-amzn-trace-id,x-amzn-requestid,x-amz-apigw-id,date
X-Amzn-Trace-Id: Root=1-xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive
{
"accessEntry": {
"clusterName": "my-cluster",
"principalArn": "arn:aws:iam::012345678910:role/my-role",
"kubernetesGroups": [],
"accessEntryArn": "arn:aws:eks:us-west-2:012345678910:accessEntry/my-cluster/role/012345678910/my-role/xxx11111-xx1x-xx9115-1x11-xxx111x111x1",
"createdAt": 1.685475163532E9,
"modifiedAt": 1.685475163532E9,
"tags": {},
"username": "arn:aws:sts::012345678910:assumed-role/my-role/{{SessionName}}",
"type": "STANDARD"
}
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: