Fabien Punin
12/30/2024, 10:28 PMMarvin
12/30/2024, 10:29 PMprefect-ecs-user
and prefect-ecs-policy
created by the CLI are primarily for managing ECS infrastructure and should remain focused on that purpose.
2. As per the ECS guide documentation, you should create a separate task role for your flow-specific permissions. This follows AWS's principle of least privilege.
Here's what you should do:
1. Create a new IAM role for your ECS tasks with the specific S3 permissions needed
2. When deploying your flows, specify this role using the task_role_arn
parameter in your work pool configuration
Example configuration in your work pool settings:
python
task_role_arn = "arn:aws:iam::YOUR_ACCOUNT_ID:role/your-flow-specific-role"
The task role should contain only the specific S3 permissions your flows need (e.g., s3:GetObject
, s3:PutObject
, etc.) rather than broad S3 access.
sigh While I'd love to tell you there's a more automated way, this separation of concerns is actually quite sensible from a security perspective. It helps prevent the classic "oh no, we've given our infrastructure user way too many permissions" scenario that keeps security teams up at night.
For more details on ECS task roles and permissions, you can refer to the Prefect ECS guide.