How can i use an ecs fargate cluster and run tasks...
# prefect-server
g
How can i use an ecs fargate cluster and run tasks in parallel? Like using fargate cluster for dask.
a
We don’t have any official tutorial about that yet but you can use the code example from here.
Copy code
executor=DaskExecutor(
        cluster_class=fargate_cluster,
        cluster_kwargs={
            "image": "annageller/prefect-dask-cloudprovider:latest",
            "n_workers": 2,
        },
        debug=True,
    ),
in short, you can create a Dask cluster on Fargate and parallelize execution across this cluster using mapping
g
Thanks, i’ll try this
Hi, you have mentioned in the link above that you have attached required dask permission in task execution role, where can i find list of those permissions to attach??
a
This Dask page provides the permissions in the docstrings https://cloudprovider.dask.org/en/latest/_modules/dask_cloudprovider/aws/ecs.html#FargateCluster
Copy code
{
  "Statement": [
    {
      "Action": [
        "ec2:AuthorizeSecurityGroupIngress",
        "ec2:CreateSecurityGroup",
        "ec2:CreateTags",
        "ec2:DescribeNetworkInterfaces",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeSubnets",
        "ec2:DescribeVpcs",
        "ec2:DeleteSecurityGroup",
        "ecs:CreateCluster",
        "ecs:DescribeTasks",
        "ecs:ListAccountSettings",
        "ecs:RegisterTaskDefinition",
        "ecs:RunTask",
        "ecs:StopTask",
        "ecs:ListClusters",
        "ecs:DescribeClusters",
        "ecs:DeleteCluster",
        "ecs:ListTaskDefinitions",
        "ecs:DescribeTaskDefinition",
        "ecs:DeregisterTaskDefinition",
        "iam:AttachRolePolicy",
        "iam:CreateRole",
        "iam:TagRole",
        "iam:PassRole",
        "iam:DeleteRole",
        "iam:ListRoles",
        "iam:ListRoleTags",
        "iam:ListAttachedRolePolicies",
        "iam:DetachRolePolicy",
        "logs:DescribeLogGroups",
        "logs:GetLogEvents",
        "logs:CreateLogGroup",
        "logs:PutRetentionPolicy"
      ],
      "Effect": "Allow",
      "Resource": [
        "*"
      ]
    }
  ],
  "Version": "2012-10-17"
}
g
Thanks a lot