Diogo Ferreira
01/09/2025, 10:52 AMMarvin
01/09/2025, 10:52 AMAmazonECSTaskExecutionRolePolicy
to your task execution role for permissions to pull images from ECR and publish logs to CloudWatch.
3. Create an ECS Worker Service: Launch an ECS service to host the worker. You'll need to create an ECS task definition specifying the necessary configurations.
4. Register the Task Definition: Use the AWS CLI to register your task definition. This step involves specifying the CPU and memory allocations, and configuring the Prefect API URL and API key.
For detailed guidance, you can refer to the Prefect ECS Guide.Diogo Ferreira
01/09/2025, 10:53 AMMarvin
01/09/2025, 10:53 AMjson
{
"family": "prefect-ecs-worker",
"networkMode": "awsvpc",
"containerDefinitions": [
{
"name": "prefect-worker",
"image": "prefecthq/prefect:latest",
"essential": true,
"memory": 512,
"cpu": 256,
"environment": [
{
"name": "PREFECT_API_URL",
"value": "<prefect-api-url>"
},
{
"name": "PREFECT_API_KEY",
"value": "<your-api-key>"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/prefect",
"awslogs-region": "<your-region>",
"awslogs-stream-prefix": "ecs"
}
}
}
],
"requiresCompatibilities": ["FARGATE"],
"cpu": "256",
"memory": "512",
"executionRoleArn": "<ecs-task-role-arn>",
"taskRoleArn": "<ecs-task-role-arn>"
}
### Key Points:
- Environment Variables: Replace <prefect-api-url>
and <your-api-key>
with your Prefect API URL and API key, respectively.
- Role ARNs: Replace <ecs-task-role-arn>
with the ARN of the IAM role you created with necessary permissions.
- Logging: Ensure the awslogs
configuration matches your desired log group and region.
For more detailed guidance, visit the Prefect ECS Guide.Diogo Ferreira
01/09/2025, 10:54 AMMarvin
01/09/2025, 10:54 AMauto_deregister_task_definition
variable is not explicitly mentioned in the Prefect ECS documentation or the excerpts I found. This variable might be part of a custom configuration or a specific Terraform module you're using for ECS.
In general, the concept of auto deregistration would involve automatically deregistering ECS task definitions that are no longer in use. This is not a built-in feature of AWS ECS but could be implemented in custom scripts or modules to manage task definitions efficiently.
For detailed and specific Terraform configurations, you might want to check the documentation or source code of the Terraform module you are using, as it might provide insights into how this variable is used or configured. If you're using a specific Terraform module for ECS, reviewing its documentation could be beneficial.