dask / dask/dask-cloudprovider
Remove IAM actions from minimal policy for AWS FargateCluster
- Dominant language
- Python
- Stars
- 147
- Forks
- 119
- PR merge metrics
- No merged PRs in 30d
Description
In the interest of minimizing the number of permissions that we need to provide to the cluster manager, I'd like to explore the option of removing the need for `iam:ListRoles` and `iam:ListRoleTags` [actions](https://github.com/dask/dask-cloudprovider/blob/9f5e73047a082cb322c50c2ec0d6cd33b8950d31/dask_cloudprovider/aws/ecs.py#L1471-L1472) if all resources are specified when creating the cluster. Looking at the code, it appears that if the `task_role_arn` and `execution_role_arn` are specified, then the iam actions are only needed when attempting to [clean up stale resources](https://github.com/dask/dask-cloudprovider/blob/9f5e73047a082cb322c50c2ec0d6cd33b8950d31/dask_cloudprovider/aws/ecs.py#L1565-L1584).
Is there support for skipping the cleanup of stale IAM roles if `task_role_arn` and `execution_role_arn` are explicitly specified? It might enable us to reduce the resources needed to ec2, ecs, and logs. (And for FargateCluster we could eliminate the need for ec2 as well).
```
"ec2:CreateTags",
"ec2:DescribeNetworkInterfaces",
"ec2:DescribeSecurityGroups",
"ec2:DescribeSubnets",
"ec2:DescribeVpcs",
"ecs:DescribeTasks",
"ecs:ListAccountSettings",
"ecs:RegisterTaskDefinition",
"ecs:RunTask",
"ecs:StopTask",
"ecs:ListClusters",
"ecs:DescribeClusters",
"ecs:ListTaskDefinitions",
"ecs:DescribeTaskDefinition",
"ecs:DeregisterTaskDefinition",
"logs:DescribeLogGroups",
"logs:GetLogEvents"
```
Contributor guide
Assessment
This issue has not been assessed yet.