BatchServiceRolePolicy

Last Modified

Aug 5, 2026

August 5, 2026 at 06:03 PM UTC

Version

v8

Total Versions

9

Created

Aug 5, 2026

Actions

80

Risk

Medium

The same capabilities in a scoped form, resource policy writes, reads across all data, or full access to a whole service. Read from this policy document alone: trust policies, boundaries and SCPs in your account still decide what actually succeeds. How this is assessed

  • Medium

    Can launch resources that run as a more privileged role

    Grants the actions of 6 documented escalation paths, but only on named resources or under a condition. Review that scope before trusting it.

    • ec2-001iam:PassRole + ec2:RunInstancesscoped
      • iam:PassRole: condition iam:PassedToService
    • ecs-002iam:PassRole + ecs:CreateCluster + ecs:RegisterTaskDefinition + ecs:RunTaskscoped
      • iam:PassRole: condition iam:PassedToService
      • ecs:CreateCluster: condition aws:RequestTag/AWSBatchServiceTag
      • ecs:RegisterTaskDefinition: condition aws:RequestTag/AWSBatchServiceTag
    • ecs-004iam:PassRole + ecs:RegisterTaskDefinition + ecs:RunTaskscoped
      • iam:PassRole: condition iam:PassedToService
      • ecs:RegisterTaskDefinition: condition aws:RequestTag/AWSBatchServiceTag
    • ecs-005iam:PassRole + ecs:RegisterTaskDefinition + ecs:StartTaskscoped
      • iam:PassRole: condition iam:PassedToService
      • ecs:RegisterTaskDefinition: condition aws:RequestTag/AWSBatchServiceTag
    • ecs-008iam:PassRole + ecs:RunTaskscoped
      • iam:PassRole: condition iam:PassedToService
    • ecs-009iam:PassRole + ecs:StartTaskscoped
      • iam:PassRole: condition iam:PassedToService

    Use with caution: Check which roles, users or policies fall inside the scope shown above. Within it the escalation works as documented, so keep privileged principals out of it.

IAM Access Analyzer (1)

  • Error / INVALID_SERVICE

    The service elastic-inference does not exist. Use a valid service name. AWS docs

Policy Document

View on GitHub
{
  "PolicyVersion": {
    "Document": {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "AWSBatchPolicyStatement1",
          "Effect": "Allow",
          "Action": [
            "ec2:DescribeAccountAttributes",
            "ec2:DescribeInstances",
            "ec2:DescribeInstanceStatus",
            "ec2:DescribeInstanceAttribute",
            "ec2:DescribeSubnets",
            "ec2:DescribeSecurityGroups",
            "ec2:DescribeKeyPairs",
            "ec2:DescribeImages",
            "ec2:DescribeImageAttribute",
            "ec2:DescribeSpotInstanceRequests",
            "ec2:DescribeSpotFleetInstances",
            "ec2:DescribeSpotFleetRequests",
            "ec2:DescribeSpotPriceHistory",
            "ec2:DescribeSpotFleetRequestHistory",
            "ec2:DescribeVpcClassicLink",
            "ec2:DescribeLaunchTemplateVersions",
            "ec2:RequestSpotFleet",
            "autoscaling:DescribeAccountLimits",
            "autoscaling:DescribeAutoScalingGroups",
            "autoscaling:DescribeLaunchConfigurations",
            "autoscaling:DescribeAutoScalingInstances",
            "autoscaling:DescribeScalingActivities",
            "eks:DescribeCluster",
            "ecs:DescribeCapacityProviders",
            "ecs:DescribeClusters",
            "ecs:DescribeContainerInstances",
            "ecs:DescribeTaskDefinition",
            "ecs:DescribeTasks",
            "ecs:ListClusters",
            "ecs:ListContainerInstances",
            "ecs:ListTaskDefinitionFamilies",
            "ecs:ListTaskDefinitions",
            "ecs:ListTasks",
            "ecs:DeregisterTaskDefinition",
            "ecs:TagResource",
            "ecs:ListAccountSettings",
            "logs:DescribeLogGroups",
            "iam:GetInstanceProfile",
            "iam:GetRole"
          ],
          "Resource": "*"
        },
        {
          "Sid": "AWSBatchPolicyStatement2",
          "Effect": "Allow",
          "Action": [
            "logs:CreateLogGroup",
            "logs:CreateLogStream"
          ],
          "Resource": "arn:aws:logs:*:*:log-group:/aws/batch/job*"
        },
        {
          "Sid": "AWSBatchPolicyStatement3",
          "Effect": "Allow",
          "Action": [
            "logs:PutLogEvents"
          ],
          "Resource": "arn:aws:logs:*:*:log-group:/aws/batch/job*:log-stream:*"
        },
        {
          "Sid": "AWSBatchPolicyStatement4",
          "Effect": "Allow",
          "Action": [
            "autoscaling:CreateOrUpdateTags"
          ],
          "Resource": "*",
          "Condition": {
            "Null": {
              "aws:RequestTag/AWSBatchServiceTag": "false"
            }
          }
        },
        {
          "Sid": "AWSBatchPolicyStatement5",
          "Effect": "Allow",
          "Action": "iam:PassRole",
          "Resource": [
            "*"
          ],
          "Condition": {
            "StringEquals": {
              "iam:PassedToService": [
                "ec2.amazonaws.com",
                "ec2.amazonaws.com.cn",
                "ecs.amazonaws.com",
                "ecs-tasks.amazonaws.com"
              ]
            }
          }
        },
        {
          "Sid": "AWSBatchPolicyStatement6",
          "Effect": "Allow",
          "Action": "iam:CreateServiceLinkedRole",
          "Resource": "*",
          "Condition": {
            "StringEquals": {
              "iam:AWSServiceName": [
                "spot.amazonaws.com",
                "spotfleet.amazonaws.com",
                "autoscaling.amazonaws.com",
                "ecs.amazonaws.com",
                "ecs-compute.amazonaws.com"
              ]
            }
          }
        },
        {
          "Sid": "AWSBatchPolicyStatement7",
          "Effect": "Allow",
          "Action": [
            "ec2:CreateLaunchTemplate"
          ],
          "Resource": "*",
          "Condition": {
            "Null": {
              "aws:RequestTag/AWSBatchServiceTag": "false"
            }
          }
        },
        {
          "Sid": "AWSBatchPolicyStatement8",
          "Effect": "Allow",
          "Action": [
            "ec2:TerminateInstances",
            "ec2:CancelSpotFleetRequests",
            "ec2:ModifySpotFleetRequest",
            "ec2:DeleteLaunchTemplate"
          ],
          "Resource": "*",
          "Condition": {
            "Null": {
              "aws:ResourceTag/AWSBatchServiceTag": "false"
            }
          }
        },
        {
          "Sid": "AWSBatchPolicyStatement9",
          "Effect": "Allow",
          "Action": [
            "autoscaling:CreateLaunchConfiguration",
            "autoscaling:DeleteLaunchConfiguration"
          ],
          "Resource": "arn:aws:autoscaling:*:*:launchConfiguration:*:launchConfigurationName/AWSBatch*"
        },
        {
          "Sid": "AWSBatchPolicyStatement10",
          "Effect": "Allow",
          "Action": [
            "autoscaling:CreateAutoScalingGroup",
            "autoscaling:UpdateAutoScalingGroup",
            "autoscaling:SetDesiredCapacity",
            "autoscaling:DeleteAutoScalingGroup",
            "autoscaling:SuspendProcesses",
            "autoscaling:PutNotificationConfiguration",
            "autoscaling:TerminateInstanceInAutoScalingGroup"
          ],
          "Resource": "arn:aws:autoscaling:*:*:autoScalingGroup:*:autoScalingGroupName/AWSBatch*"
        },
        {
          "Sid": "AWSBatchPolicyStatement11",
          "Effect": "Allow",
          "Action": [
            "ecs:DeleteCluster",
            "ecs:DeregisterContainerInstance",
            "ecs:PutClusterCapacityProviders",
            "ecs:RunTask",
            "ecs:StartTask",
            "ecs:StopTask",
            "ecs:UpdateCluster"
          ],
          "Resource": "arn:aws:ecs:*:*:cluster/AWSBatch*"
        },
        {
          "Sid": "AWSBatchPolicyStatement12",
          "Effect": "Allow",
          "Action": [
            "ecs:RunTask",
            "ecs:StartTask",
            "ecs:StopTask"
          ],
          "Resource": "arn:aws:ecs:*:*:task-definition/*"
        },
        {
          "Sid": "AWSBatchPolicyStatement13",
          "Effect": "Allow",
          "Action": [
            "ecs:StopTask"
          ],
          "Resource": "arn:aws:ecs:*:*:task/*/*"
        },
        {
          "Sid": "AWSBatchPolicyStatement14",
          "Effect": "Allow",
          "Action": [
            "ecs:CreateCluster",
            "ecs:RegisterTaskDefinition"
          ],
          "Resource": "*",
          "Condition": {
            "Null": {
              "aws:RequestTag/AWSBatchServiceTag": "false"
            }
          }
        },
        {
          "Sid": "AWSBatchPolicyStatement15",
          "Effect": "Allow",
          "Action": "ec2:RunInstances",
          "Resource": [
            "arn:aws:ec2:*::image/*",
            "arn:aws:ec2:*::snapshot/*",
            "arn:aws:ec2:*:*:subnet/*",
            "arn:aws:ec2:*:*:network-interface/*",
            "arn:aws:ec2:*:*:security-group/*",
            "arn:aws:ec2:*:*:volume/*",
            "arn:aws:ec2:*:*:key-pair/*",
            "arn:aws:ec2:*:*:launch-template/*",
            "arn:aws:ec2:*:*:placement-group/*",
            "arn:aws:ec2:*:*:capacity-reservation/*",
            "arn:aws:ec2:*:*:elastic-gpu/*",
            "arn:aws:elastic-inference:*:*:elastic-inference-accelerator/*",
            "arn:aws:resource-groups:*:*:group/*"
          ]
        },
        {
          "Sid": "AWSBatchPolicyStatement16",
          "Effect": "Allow",
          "Action": "ec2:RunInstances",
          "Resource": "arn:aws:ec2:*:*:instance/*",
          "Condition": {
            "Null": {
              "aws:RequestTag/AWSBatchServiceTag": "false"
            }
          }
        },
        {
          "Sid": "AWSBatchPolicyStatement17",
          "Effect": "Allow",
          "Action": [
            "ec2:CreateTags"
          ],
          "Resource": [
            "*"
          ],
          "Condition": {
            "StringEquals": {
              "ec2:CreateAction": [
                "RunInstances",
                "CreateLaunchTemplate",
                "RequestSpotFleet"
              ]
            }
          }
        },
        {
          "Sid": "AWSBatchPolicyStatement18",
          "Effect": "Allow",
          "Action": [
            "ecs:CreateCapacityProvider",
            "ecs:UpdateCapacityProvider",
            "ecs:DeleteCapacityProvider"
          ],
          "Resource": "arn:aws:ecs:*:*:capacity-provider/AWSBatch*"
        },
        {
          "Sid": "AWSBatchPolicyStatement19",
          "Effect": "Allow",
          "Action": [
            "ecs:TagResource",
            "ecs:UntagResource"
          ],
          "Resource": [
            "arn:aws:ecs:*:*:capacity-provider/AWSBatch*"
          ]
        }
      ]
    },
    "VersionId": "v8",
    "IsDefaultVersion": true,
    "CreateDate": "2026-08-05T17:12:14+00:00"
  }
}

Version History (12 recorded)

Raw history
v8updated

7 actions added

5a3ee01
v7updated

scope changed, no action added or removed

81f7305

Update detected

No recorded action delta - this version predates the change index. View the raw diff.

Sep 18, 2024

aafbae9

Update detected

No recorded action delta - this version predates the change index. View the raw diff.

May 13, 2024

1b36617

Update detected

No recorded action delta - this version predates the change index. View the raw diff.

Dec 5, 2023

81e7c90

Update detected

No recorded action delta - this version predates the change index. View the raw diff.

Oct 17, 2022

91ca9b7

Update detected

No recorded action delta - this version predates the change index. View the raw diff.

May 18, 2022

1ae5d38

Update detected

No recorded action delta - this version predates the change index. View the raw diff.

May 18, 2022

fcb5520

Update detected

No recorded action delta - this version predates the change index. View the raw diff.

Dec 7, 2021

7ef6dbc

Update detected

No recorded action delta - this version predates the change index. View the raw diff.

Mar 26, 2021

1da5c89

Update detected

No recorded action delta - this version predates the change index. View the raw diff.

Mar 11, 2021

4550284

Update detected

No recorded action delta - this version predates the change index. View the raw diff.

Mar 10, 2021

7d52b89