<@ULVA73B9P> why are my ecs tasks deploying on x86...
# marvin-ai
m
@Marvin why are my ecs tasks deploying on x86 and not arm64, my worker is arm64, my image is built on arm64. I can see the auto created task definition lacks the architechture. What setting is missing from my set up?
m
thought for 611.6 seconds
Short answer: your ECS task definition is missing
runtimePlatform.cpuArchitecture: ARM64
. Prefect’s default ECS work pool template doesn’t set this, so AWS defaults to x86_64 even if your worker host and image are arm64. Two ways to fix it: 1) Easiest: point the pool at a pre-registered task definition (with ARM64) - Register a task definition in ECS that includes the runtime platform:
Copy code
aws ecs register-task-definition \
  --family my-prefect-arm64 \
  --cpu "1024" \
  --memory "2048" \
  --network-mode awsvpc \
  --requires-compatibilities FARGATE \
  --execution-role-arn arn:aws:iam::<acct>:role/ecsTaskExecutionRole \
  --task-role-arn arn:aws:iam::<acct>:role/<your-task-role> \
  --runtime-platform '{"cpuArchitecture":"ARM64","operatingSystemFamily":"LINUX"}' \
  --container-definitions '[{"name":"prefect","image":"<your-image>","essential":true}]'
- In your Prefect ECS work pool settings, set the
task_definition_arn
variable to that ARN. When set, the worker will use that task definition instead of auto-creating one. 2) Customize the work pool’s base job template to include
runtimePlatform
- Get the default template:
Copy code
prefect work-pool get-default-base-job-template --type ecs > ecs-base.json
- Edit ecs-base.json to add
runtimePlatform
under
job_configuration.task_definition
(and optionally make the arch configurable):
Copy code
"task_definition": {
  "containerDefinitions": [
    {"image": "{{ image }}", "name": "{{ container_name }}"}
  ],
  "cpu": "{{ cpu }}",
  "family": "{{ family }}",
  "memory": "{{ memory }}",
  "executionRoleArn": "{{ execution_role_arn }}",
  "runtimePlatform": {
    "cpuArchitecture": "{{ cpu_architecture }}",
    "operatingSystemFamily": "LINUX"
  }
},
- In the same file, add a variable to the schema (so you can set it in the UI):
Copy code
"variables": {
  "description": "Variables for templating an ECS job.",
  "type": "object",
  "properties": {
    ...
    "cpu_architecture": {
      "title": "CPU architecture",
      "type": "string",
      "default": "ARM64",
      "enum": ["ARM64", "X86_64"]
    }
  }
}
- Create/update the pool with the template:
Copy code
prefect work-pool create "my-ecs-pool" --type ecs --base-job-template ecs-base.json
Notes: - The worker machine’s architecture doesn’t influence ECS task architecture; AWS picks x86_64 unless you set runtimePlatform. - This applies to both Fargate and EC2 launch types; for EC2 you also need ARM64-capable container instances/capacity providers in the cluster. - Your image being arm64 is correct, but ECS won’t infer ARM64 from the image alone. Docs: - ECS worker guide: Prefect ECS guide If you can share whether you’re using Fargate or EC2 and whether you prefer a pre-registered task definition vs. editing the base job template, I can tailor the exact JSON/steps for your setup.