AWS Security ChangesHomeSearch

AWS batch: Migrate AWS Batch EKS tutorial to access entries

Service: batch · 2026-10-07 · Documentation medium

File: batch/latest/userguide/getting-started-eks.md · Type: iam

Summary

Rewrites the AWS Batch on Amazon EKS getting started tutorial to use Amazon EKS access entries instead of aws-auth ConfigMap RBAC, adds required IAM permissions for managing access entries, namespace-scoped AWSBatchNamespacePolicy association, and cleanup guidance to disable accessEntry.desiredState.

Security assessment

Documents the IAM permissions required for AWS Batch to create and manage EKS access entries and namespace-scoped access policies, replacing manual aws-auth ConfigMap RBAC. This is security-relevant authorization guidance, but no specific vulnerability, CVE, or incident is referenced.

Evidence

+  * Permissions – Users calling the [CreateComputeEnvironment](https://docs.aws.amazon.com/batch/latest/APIReference/API_CreateComputeEnvironment.html) API operation to create a compute environment that uses Amazon EKS resources require permissions to the `eks:DescribeCluster` API operation. When using access entries, AWS Batch manages the access entry using your credentials, so you also need permissions to manage Amazon EKS access entries: `eks:DescribeAccessEntry`, `eks:CreateAccessEntry`, `eks:AssociateAccessPolicy`, and `eks:DeleteAccessEntry`. For more information, see [Required permissions](./eks-access-entries.html#eks-access-entries-permissions).

Diff

diff --git a/batch/latest/userguide/getting-started-eks.md b/batch/latest/userguide/getting-started-eks.md
index 0c8816e..9d2720e 100644
--- a//batch/latest/userguide/getting-started-eks.md
+++ b//batch/latest/userguide/getting-started-eks.md
@@ -7 +7 @@
-OverviewPrerequisitesStep 1: Create your Amazon EKS cluster for AWS BatchStep 2: Prepare your Amazon EKS cluster for AWS BatchStep 3: Create an Amazon EKS compute environmentStep 4: Create a job queue and attach the compute environmentStep 5: Create a job definitionStep 6: Submit a jobStep 7: View the Job's outputStep 8: (Optional) Submit a job with overridesStep 9: Clean up your tutorial resourcesAdditional resources
+OverviewPrerequisitesStep 1: Create your Amazon EKS cluster for AWS BatchStep 2: Prepare your Amazon EKS cluster for AWS BatchStep 3: Create an Amazon EKS compute environmentStep 3a: Associate the namespace policyStep 4: Create a job queue and attach the compute environmentStep 5: Create a job definitionStep 6: Submit a jobStep 7: View the Job's outputStep 8: (Optional) Submit a job with overridesStep 9: Clean up your tutorial resourcesAdditional resources
@@ -13 +13,9 @@ AWS Batch on Amazon EKS is a managed service for scheduling and scaling batch wo
-AWS Batch doesn't touch nodes, auto scaling node groups or pods lifecycles that aren't associated with AWS Batch compute environments within your Amazon EKS cluster. For AWS Batch to operate effectively, its [service-linked role](./using-service-linked-roles.html) needs Kubernetes role-based access control (RBAC) permissions in your existing Amazon EKS cluster. For more information, see [Using RBAC Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) in the _Kubernetes documentation_.
+###### Note
+
+This tutorial uses Amazon EKS access entries for cluster authentication. Access entries are the recommended method and are required for Amazon EKS clusters whose `authenticationMode` is `API`. They're also available for Amazon EKS clusters whose `authenticationMode` is `API_AND_CONFIG_MAP`.
+
+If your cluster's `authenticationMode` is `CONFIG_MAP`, we recommend that you update your cluster to `API_AND_CONFIG_MAP` so that you can follow this tutorial. To use the legacy `aws-auth` ConfigMap approach, see [Getting started with AWS Batch on Amazon EKS using ConfigMap authentication](./getting-started-eks-configmap.html).
+
+For more information about authentication methods, see [Amazon EKS access entry authentication](./eks-access-entries.html).
+
+AWS Batch doesn't touch nodes, auto scaling node groups or pods lifecycles that aren't associated with AWS Batch compute environments within your Amazon EKS cluster. For AWS Batch to operate effectively, its [service-linked role](./using-service-linked-roles.html) needs access to your existing Amazon EKS cluster. AWS Batch creates an Amazon EKS access entry for the service-linked role, and you associate an access policy that grants AWS Batch permissions in your namespace.
@@ -17 +25 @@ AWS Batch requires a Kubernetes namespace where it can scope pods as AWS Batch j
-After AWS Batch has been given RBAC access and a namespace has been established, you can associate that Amazon EKS cluster to an AWS Batch compute environment using the [CreateComputeEnvironment](https://docs.aws.amazon.com/batch/latest/APIReference/API_CreateComputeEnvironment.html) API operation. A job queue can be associated with this new Amazon EKS compute environment. AWS Batch jobs are submitted to the job queue based on an Amazon EKS job definition using the [SubmitJob](https://docs.aws.amazon.com/batch/latest/APIReference/API_SubmitJob.html) API operation. AWS Batch then launches AWS Batch managed nodes and place jobs from job queue as Kubernetes pods into the EKS cluster associated with an AWS Batch compute environment.
+After a namespace has been established, you can associate that Amazon EKS cluster to an AWS Batch compute environment using the [CreateComputeEnvironment](https://docs.aws.amazon.com/batch/latest/APIReference/API_CreateComputeEnvironment.html) API operation. A job queue can be associated with this new Amazon EKS compute environment. AWS Batch jobs are submitted to the job queue based on an Amazon EKS job definition using the [SubmitJob](https://docs.aws.amazon.com/batch/latest/APIReference/API_SubmitJob.html) API operation. AWS Batch then launches AWS Batch managed nodes and place jobs from job queue as Kubernetes pods into the EKS cluster associated with an AWS Batch compute environment.
@@ -32,0 +41,2 @@ The following sections cover how to get set up for AWS Batch on Amazon EKS.
+  * [Step 3a: Associate the namespace policy](./getting-started-eks.html#getting-started-eks-step-2a)
+
@@ -100 +110 @@ Before starting this tutorial, you must install and configure the following tool
-  * AWS CLI – A command line tool for working with AWS services, including Amazon EKS. This guide requires that you use version 2.8.6 or later or 1.26.0 or later. For more information, see [Installing, updating, and uninstalling the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) in the _AWS Command Line Interface User Guide_. After installing the AWS CLI, we recommend that you also configure it. For more information, see [Quick configuration with `aws configure`](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-config) in the _AWS Command Line Interface User Guide_.
+  * AWS CLI – A command line tool for working with AWS services, including Amazon EKS. This guide requires that you use version 2.37.7 or later of the AWS CLI version 2. Earlier versions don't support the `accessEntry` parameter. For more information, see [Installing, updating, and uninstalling the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) in the _AWS Command Line Interface User Guide_. After installing the AWS CLI, we recommend that you also configure it. For more information, see [Quick configuration with `aws configure`](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-config) in the _AWS Command Line Interface User Guide_.
@@ -102 +112 @@ Before starting this tutorial, you must install and configure the following tool
-  * `kubectl` – A command line tool for working with Kubernetes clusters. This guide requires that you use version `1.23` or later. For more information, see [Installing or updating `kubectl`](https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html) in the _Amazon EKS User Guide_.
+  * `kubectl` – A command line tool for working with Kubernetes clusters. Use a `kubectl` version that's within one minor version difference of your cluster's Kubernetes version. For more information, see [Installing or updating `kubectl`](https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html) in the _Amazon EKS User Guide_.
@@ -104 +114 @@ Before starting this tutorial, you must install and configure the following tool
-  * ``eksctl`` – A command line tool for working with Amazon EKS clusters that automates many individual tasks. This guide requires that you use version `0.115.0` or later. For more information, see [Installing or updating ``eksctl``](https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html) in the __Amazon EKS User Guide__.
+  * ``eksctl`` – A command line tool for working with Amazon EKS clusters that automates many individual tasks. This guide requires that you use version `0.167.0` or later. For more information, see [Installing or updating ``eksctl``](https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html) in the __Amazon EKS User Guide__.
@@ -108 +118 @@ Before starting this tutorial, you must install and configure the following tool
-  * Permissions – Users calling the [CreateComputeEnvironment](https://docs.aws.amazon.com/batch/latest/APIReference/API_CreateComputeEnvironment.html) API operation to create a compute environment that uses Amazon EKS resources require permissions to the `eks:DescribeCluster` API operation. 
+  * Permissions – Users calling the [CreateComputeEnvironment](https://docs.aws.amazon.com/batch/latest/APIReference/API_CreateComputeEnvironment.html) API operation to create a compute environment that uses Amazon EKS resources require permissions to the `eks:DescribeCluster` API operation. When using access entries, AWS Batch manages the access entry using your credentials, so you also need permissions to manage Amazon EKS access entries: `eks:DescribeAccessEntry`, `eks:CreateAccessEntry`, `eks:AssociateAccessPolicy`, and `eks:DeleteAccessEntry`. For more information, see [Required permissions](./eks-access-entries.html#eks-access-entries-permissions).
@@ -141 +151 @@ The cluster name and region are needed for later in this tutorial.
-All steps are required.
+This method uses Amazon EKS access entries to grant AWS Batch cluster access. It eliminates the need for manual RBAC configuration and `aws-auth` ConfigMap edits.
@@ -167,46 +177 @@ Output:
-  2. ###### Enable access via role-based access control (RBAC)
-
-Use `kubectl` to create a Kubernetes role for the cluster to allow AWS Batch to watch nodes and pods, and to bind the role. You must do this once for each EKS cluster.
-    
-        $ cat - <<EOF | kubectl apply -f -
-    apiVersion: rbac.authorization.k8s.io/v1
-    kind: ClusterRole
-    metadata:
-      name: aws-batch-cluster-role
-    rules:
-      - apiGroups: [""]
-        resources: ["namespaces"]
-        verbs: ["get"]
-      - apiGroups: [""]
-        resources: ["nodes"]
-        verbs: ["get", "list", "watch"]
-      - apiGroups: [""]
-        resources: ["pods"]
-        verbs: ["get", "list", "watch"]
-      - apiGroups: [""]
-        resources: ["events"]
-        verbs: ["list"]
-      - apiGroups: [""]
-        resources: ["configmaps"]
-        verbs: ["get", "list", "watch"]
-      - apiGroups: ["apps"]
-        resources: ["daemonsets", "deployments", "statefulsets", "replicasets"]
-        verbs: ["get", "list", "watch"]
-      - apiGroups: ["rbac.authorization.k8s.io"]
-        resources: ["clusterroles", "clusterrolebindings"]
-        verbs: ["get", "list"]
-    ---
-    apiVersion: rbac.authorization.k8s.io/v1
-    kind: ClusterRoleBinding
-    metadata:
-      name: aws-batch-cluster-role-binding
-    subjects:
-    - kind: User
-      name: aws-batch
-      apiGroup: rbac.authorization.k8s.io
-    roleRef:
-      kind: ClusterRole
-      name: aws-batch-cluster-role
-      apiGroup: rbac.authorization.k8s.io
-    EOF
-    
+  2. ###### Configure cluster access for the node instance role
@@ -214,40 +179 @@ Use `kubectl` to create a Kubernetes role for the cluster to allow AWS Batch to
-Output:
-    
-        clusterrole.rbac.authorization.k8s.io/aws-batch-cluster-role created
-    clusterrolebinding.rbac.authorization.k8s.io/aws-batch-cluster-role-binding created
-
-  3. Create namespace-scoped Kubernetes role for AWS Batch to manage and lifecycle pods and bind it. You must do this once for each unique namespace.
-    
-        $ namespace=my-aws-batch-namespace
-    
-        $ cat - <<EOF | kubectl apply -f - --namespace "${namespace}"
-    apiVersion: rbac.authorization.k8s.io/v1
-    kind: Role
-    metadata:
-      name: aws-batch-compute-environment-role
-      namespace: ${namespace}
-    rules:
-      - apiGroups: [""]
-        resources: ["pods"]
-        verbs: ["create", "get", "list", "watch", "delete", "patch"]
-      - apiGroups: [""]
-        resources: ["serviceaccounts"]
-        verbs: ["get", "list"]
-      - apiGroups: ["rbac.authorization.k8s.io"]
-        resources: ["roles", "rolebindings"]
-        verbs: ["get", "list"]
-    ---
-    apiVersion: rbac.authorization.k8s.io/v1
-    kind: RoleBinding
-    metadata:
-      name: aws-batch-compute-environment-role-binding
-      namespace: ${namespace}
-    subjects:
-    - kind: User
-      name: aws-batch
-      apiGroup: rbac.authorization.k8s.io
-    roleRef:
-      kind: Role
-      name: aws-batch-compute-environment-role
-      apiGroup: rbac.authorization.k8s.io
-    EOF
+Instances launched by AWS Batch join the cluster using the instance profile that you specify in `computeResources.instanceRole` when you create the compute environment in the next step. That role needs its own access to the cluster, which is separate from the AWS Batch-managed access entry.
@@ -254,0 +181 @@ Output:
+The node instance role is created when you create the cluster. To find the node instance role, list all entities that use the `AmazonEKSWorkerNodePolicy` policy:
@@ -256,4 +183 @@ Output:
-Output:
-    
-        role.rbac.authorization.k8s.io/aws-batch-compute-environment-role created
-    rolebinding.rbac.authorization.k8s.io/aws-batch-compute-environment-role-binding created
+        $  aws iam list-entities-for-policy --policy-arn arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy
@@ -261 +185 @@ Output:
-  4. Update Kubernetes `aws-auth` configuration map to map the preceding RBAC permissions to the AWS Batch service-linked role.
+The command lists every role that uses this policy. Choose the role whose name contains your cluster name, for example `eksctl-`my-cluster-name`-nodegroup-example`.
@@ -263 +187 @@ Output:
-In the following command replace:
+This step is only needed if the node instance role doesn't already have an access entry on the cluster. For example, Amazon EKS typically creates an access entry for the node role of a managed node group, such as the one that `eksctl` created in Step 1. To check whether the role already has an access entry, run the following command:
@@ -265 +189,3 @@ In the following command replace:
-     * Replace `<your-account-number>` with your AWS account number. 
+        $ aws eks describe-access-entry \
+        --cluster-name my-cluster-name \
+        --principal-arn arn:aws:iam::your-account-number:role/eksctl-my-cluster-name-nodegroup-example
@@ -267,4 +193 @@ In the following command replace:
-        $ eksctl create iamidentitymapping \
-        --cluster my-cluster-name \
-        --arn "arn:aws:iam::<your-account-number>:role/AWSServiceRoleForBatch" \
-        --username aws-batch
+Replace `eksctl-my-cluster-name-nodegroup-example` with the name of the node instance role that the previous command returned.
@@ -271,0 +195 @@ In the following command replace:
+If the command returns the access entry, skip the rest of this step. If it returns a `ResourceNotFoundException` error, create an access entry for the node instance role:
@@ -273,3 +197,4 @@ In the following command replace:
-Output:
-    
-        2022-10-25 20:19:57 [ℹ]  adding identity "arn:aws:iam::<your-account-number>:role/AWSServiceRoleForBatch" to auth ConfigMap
+        $ aws eks create-access-entry \
+        --cluster-name my-cluster-name \
+        --principal-arn arn:aws:iam::your-account-number:role/eksctl-my-cluster-name-nodegroup-example \
+        --type EC2_LINUX
@@ -279 +204 @@ Output:
-The path `aws-service-role/batch.amazonaws.com/` has been removed from the ARN of the service-linked role. This is because of an issue with the `aws-auth` configuration map. For more information, see [Roles with paths don't work when the path is included in their ARN in the aws-authconfigmap](https://github.com/kubernetes-sigs/aws-iam-authenticator/issues/268).
+On clusters whose `authenticationMode` is `API_AND_CONFIG_MAP`, if the node instance role is already mapped in the `aws-auth` ConfigMap, you can also skip this step. Nodes join successfully using the ConfigMap entry. On clusters whose `authenticationMode` is `API`, the ConfigMap isn't used, so the node instance role must have an access entry.
@@ -283 +208 @@ The path `aws-service-role/batch.amazonaws.com/` has been removed from the ARN o
-Once an AWS Batch-managed access entry is created for the AWS Batch service-linked role on the cluster (`accessEntry.status=ACTIVE`), it takes precedence over the `aws-auth` ConfigMap configuration for the role. The ConfigMap entries for the AWS Batch service-linked role are unused, and AWS Batch authenticates using the access entry instead. For more information about access entries, see [Amazon EKS access entry authentication](./eks-access-entries.html).
+Without proper cluster access for the node instance role, EC2 instances cannot join the cluster. Jobs will remain in the `RUNNABLE` state because no capacity registers with the cluster.
@@ -292 +217 @@ AWS Batch compute environments define compute resource parameters to meet your b
-Now that the **AWSServiceRoleForBatch** service-linked role has access to your Amazon EKS cluster, you can create AWS Batch resources. First, create a compute environment that points to your Amazon EKS cluster.
+Create a compute environment that targets your Amazon EKS cluster. Because the compute environment sets `accessEntry.desiredState` to `ENABLED`, AWS Batch creates an access entry for the **AWSServiceRoleForBatch** service-linked role on your cluster. You grant that access entry permissions in your namespace in the next step.
@@ -302,7 +227 @@ Now that the **AWSServiceRoleForBatch** service-linked role has access to your A
-  * The `instanceRole` is created when you create the cluster. To find the `instanceRole` list all entities that use the `AmazonEKSWorkerNodePolicy` policy: 
-    
-        $  aws iam list-entities-for-policy --policy-arn arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy
-
-The name of the policy role contains the name of the cluster that you created `eksctl-`my-cluster-name`-nodegroup-example`. 
-
-To find the `instanceRole` arn run the following command:
+  * The `instanceRole` is the instance profile for the node instance role that you found in Step 2. To find the `instanceRole` arn run the following command:
@@ -316 +235 @@ Output:
-For more information, see [Creating the Amazon EKS node IAM role](https://docs.aws.amazon.com/eks/latest/userguide/create-node-role.html#create-worker-node-role) and [Enabling IAM principal access to your cluster](https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html) in the _Amazon EKS User Guide_. If you're using pod networking, see [Configuring the Amazon VPC CNI plugin for Kubernetes to use IAM roles for service accounts](https://docs.aws.amazon.com/eks/latest/userguide/cni-iam-role.html) in the __Amazon EKS User Guide__.
+For more information, see [Creating the Amazon EKS node IAM role](https://docs.aws.amazon.com/eks/latest/userguide/create-node-role.html#create-worker-node-role) and [Grant IAM users access to Kubernetes with Amazon EKS access entries](https://docs.aws.amazon.com/eks/latest/userguide/access-entries.html) in the _Amazon EKS User Guide_. If you're using pod networking, see [Configuring the Amazon VPC CNI plugin for Kubernetes to use IAM roles for service accounts](https://docs.aws.amazon.com/eks/latest/userguide/cni-iam-role.html) in the __Amazon EKS User Guide__.
@@ -329 +248,4 @@ For more information, see [Creating the Amazon EKS node IAM role](https://docs.a
-        "kubernetesNamespace": "my-aws-batch-namespace"
+        "kubernetesNamespace": "my-aws-batch-namespace",
+        "accessEntry": {
+          "desiredState": "ENABLED"
+        }
@@ -360,0 +283,54 @@ For more information, see [Creating the Amazon EKS node IAM role](https://docs.a
+## Step 3a: Associate the namespace policy
+
+After creating the compute environment with `accessEntry.desiredState=ENABLED`, AWS Batch creates a cluster-level access entry. You must then associate the namespace-scoped `AWSBatchNamespacePolicy` to grant AWS Batch permission to create and manage pods in your namespace.
+
+###### Important
+
+Without the namespace-scoped policy association, jobs will remain stuck in `RUNNABLE` status. The cluster-level policy alone does not grant pod management permissions.
+