Jordan Fisher
03/30/2026, 3:58 PMMarvin
03/30/2026, 3:58 PMMarvin
03/30/2026, 3:59 PM{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ECSCore",
"Effect": "Allow",
"Action": [
"ecs:CreateCluster",
"ecs:DeleteCluster",
"ecs:DescribeClusters",
"ecs:ListClusters",
"ecs:RegisterTaskDefinition",
"ecs:DeregisterTaskDefinition",
"ecs:DescribeTaskDefinition",
"ecs:RunTask",
"ecs:StopTask",
"ecs:DescribeTasks",
"ecs:ListTasks",
"ecs:CreateService",
"ecs:UpdateService",
"ecs:DeleteService",
"ecs:DescribeServices"
],
"Resource": "*"
},
{
"Sid": "Logs",
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogGroups",
"logs:DescribeLogStreams"
],
"Resource": "*"
},
{
"Sid": "EC2NetworkingIfManagingSG",
"Effect": "Allow",
"Action": [
"ec2:DescribeVpcs",
"ec2:DescribeSubnets",
"ec2:DescribeSecurityGroups",
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:RevokeSecurityGroupIngress",
"ec2:AuthorizeSecurityGroupEgress",
"ec2:RevokeSecurityGroupEgress"
],
"Resource": "*"
},
{
"Sid": "PassExecutionAndTaskRoles",
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": [
"arn:aws:iam::<ACCOUNT_ID>:role/<YourDaskExecutionRole>",
"arn:aws:iam::<ACCOUNT_ID>:role/<YourDaskTaskRole>"
]
}
]
}
Don’t forget the ECS task execution role
- This is separate from the “task run role.” The execution role used by the Dask scheduler/worker tasks must be able to pull images and write logs, e.g.:
- ecr:GetAuthorizationToken, ecr:BatchGetImage, ecr:GetDownloadUrlForLayer (if using private ECR)
- logs:CreateLogStream, logs:PutLogEvents
- AWS creates/uses the service-linked role AWSServiceRoleForECS for ENIs; you typically do not need ec2:CreateNetworkInterface permissions on your task role.
Tips to minimize permissionsMarvin
03/30/2026, 3:59 PMfrom dask_cloudprovider.aws import FargateCluster
from dask.distributed import Client
cluster = FargateCluster(
region_name="us-east-1",
vpc_id="vpc-xxxxxxxx",
subnets=["subnet-aaaa", "subnet-bbbb"],
security_groups=["sg-cccccccc"],
task_role_arn="arn:aws:iam::<acct>:role/YourDaskTaskRole",
execution_role_arn="arn:aws:iam::<acct>:role/YourDaskExecutionRole",
image="public.ecr.aws/dask/dask:latest"
)
client = Client(cluster)
Docs and references
- Prefect ECS work pools: Prefect ECS compute docs
- dask-cloudprovider Fargate: FargateCluster docs
- dask-cloudprovider repo (issues/examples): dask-cloudprovider on GitHub
Questions for you
- Do you want FargateCluster to create the ECS cluster and security group, or will you supply existing ones?
- Are your Dask images in private ECR? If so, confirm your execution role has the ECR pull permissions above.
If you share which parts you plan to manage vs. auto-create, I can trim this policy down to a tighter, least-privilege version for your setup.