AWS::EKS::AccessEntry - AWS CloudFormation

AWS::EKS::AccessEntry

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.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::EKS::AccessEntry", "Properties" : { "AccessPolicies" : [ AccessPolicy, ... ], "ClusterName" : String, "KubernetesGroups" : [ String, ... ], "PrincipalArn" : String, "Tags" : [ Tag, ... ], "Type" : String, "Username" : String } }

YAML

Type: AWS::EKS::AccessEntry Properties: AccessPolicies: - AccessPolicy ClusterName: String KubernetesGroups: - String PrincipalArn: String Tags: - Tag Type: String Username: String

Properties

AccessPolicies

The access policies to associate to the access entry.

Required: No

Type: Array of AccessPolicy

Maximum: 20

Update requires: No interruption

ClusterName

The name of your cluster.

Required: Yes

Type: String

Minimum: 1

Update requires: Replacement

KubernetesGroups

The value for name that you've specified for kind: Group as a subject in a Kubernetes RoleBinding or ClusterRoleBinding object. Amazon EKS doesn't confirm that the value for name 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 Kubernetes Role or ClusterRole object that is also specified in a binding's roleRef. For more information about creating Kubernetes RoleBinding, ClusterRoleBinding, Role, or ClusterRole 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 the principalArn), you can associate one or more access policies to the access entry using AssociateAccessPolicy. If you associate any access policies, the principalARN has all permissions assigned in the associated access policies and all permissions in any Kubernetes Role or ClusterRole objects that the group names are bound to.

Required: No

Type: Array of String

Update requires: No interruption

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.

Required: Yes

Type: String

Minimum: 1

Update requires: Replacement

Tags

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.

Required: No

Type: Array of Tag

Update requires: No interruption

Type

The type of the new access entry. Valid values are Standard, FARGATE_LINUX, EC2_LINUX, and EC2_WINDOWS.

If the principalArn is for an IAM role that's used for self-managed Amazon EC2 nodes, specify EC2_LINUX or EC2_WINDOWS. Amazon EKS grants the necessary permissions to the node for you. If the principalArn is for any other purpose, specify STANDARD. If you don't specify a value, Amazon EKS sets the value to STANDARD. 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 the aws-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 or EC2_WINDOWS, you can't specify values for kubernetesGroups, or associate an AccessPolicy to the access entry.

Required: No

Type: String

Update requires: Replacement

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.

Required: No

Type: String

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the resource name. For example:

{ "Ref": "arn:aws:iam::012345678910:role/my-role" }

For the access entry arn:aws:iam::012345678910:role/my-role, Ref returns the ARN of the access entry.

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

AccessEntryArn

The ARN of the access entry.

Examples

Create an access entry

The following example creates an access entry of type STANDARD for an IAM role named my-role. The role has administrator permissions for all resources in the namespace named my-namespace and edit permissions for all resources on the cluster.

JSON

{ "myAccessEntry": { "Type" : "AWS::EKS::AccessEntry", "Properties" : { "ClusterName": "my-cluster", "PrincipalArn": "arn:aws:iam::012345678910:role/my-role", "Username": "admin", "KubernetesGroups": ["my-group1", "my-group2"], "AccessPolicies": [ { "PolicyArn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSAdminPolicy", "AccessScope": { "Type": "namespace", "Namespaces": ["my-namespace"] } }, { "PolicyArn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSEditPolicy", "AccessScope": { "Type": "cluster" } } ], "Type": "STANDARD", "Tags" : [ { "Key": "my-tagkey", "Value": "my-tagvalue" } ] } } }

YAML

MyAccessEntry: Type: 'AWS::EKS::AccessEntry' Properties: ClusterName: 'my-cluster' PrincipalArn: 'arn:aws:iam::012345678910:role/my-role' Username: 'admin' KubernetesGroups: - 'my-group1' - 'my-group2' AccessPolicies: - PolicyArn: 'arn:aws:eks::aws:cluster-access-policy/AmazonEKSAdminPolicy' AccessScope: Type: 'namespace' Namespaces: - 'my-namespace' - PolicyArn: 'arn:aws:eks::aws:cluster-access-policy/AmazonEKSEditPolicy' AccessScope: Type: 'cluster' Type: 'STANDARD' Tags: - Key: 'my-tagkey' Value: 'my-tagvalue'

See also