0

I would like to experiment with attaching Inference Accelerators to an ECS task. I created the following Cloudformation template:

{
    "Resources": {
        "Task": {
          "Type" : "AWS::ECS::TaskDefinition",
          "Properties" : {
              "ContainerDefinitions" : [
                  {
                      "Name": "TestAccelerated",
                      "Image": "xxxxxxxxxxxxx.dkr.ecr.eu-central-1.amazonaws.com/myimage",
                      "Essential": true,
                      "ResourceRequirements": [{
                          "Type": "InferenceAccelerator",
                          "Value": "eia-device-1"
                      }]
                  }
              ],
              "Cpu" : "256",
              "ExecutionRoleArn" : "arn:aws:iam::xxxxxxxxxxxxx:role/ecsTaskExecutionRole",
              "Family" : "TestService",
              "InferenceAccelerators" : [ {
                "DeviceName": "eia-device-1",
                "DeviceType": "eia1.medium"
              } ],
              "Memory" : "512",
              "NetworkMode" : "awsvpc",
              "RequiresCompatibilities" : [ "FARGATE" ],
              "TaskRoleArn" : "arn:aws:iam::xxxxxxxxxxxxx:role/ecsTaskExecutionRole"
            }
        }
    }
}

When I try to create the stack, cloudformation fails with the following error:

Invalid request provided: Create TaskDefinition: Unsupported field 'inferenceAccelerators'

However there are two things that seem strange to me:

  • The field I used has an uppercase I, while the error mentions it with lowercase i
  • The field InferenceAccelerators is supposedly a supported field according to the documentation

Is there something wrong that I'm doing, is this a bug, or for some reason Inference Accelerators are really not supported in Task Definitions ?

feralgeometry
  • 120
  • 1
  • 1
  • 7

1 Answers1

1

Probably because you are using FARGATE and Fargate does not support GPUs. But the support is already on the AWS roadmap:

You can try redefine your task definition and ecs service for EC2 launch type, instead of Fargate.

Update

Amazon Elastic Inference is only for EC2-type ECS tasks:

This feature is supported when using Linux containers and tasks that use the EC2 launch type.

Marcin
  • 215,873
  • 14
  • 235
  • 294
  • I replaced `Fargate` with `ECS` in the `RequiresCompatibilities` field, but get exactly the same error. Also, I understand that GPUs are not supported on Fargate yet, but I was under the impression that IAs actually [are network attached devices](https://aws.amazon.com/machine-learning/elastic-inference/faqs/), so one would expect them to work on Fargate instances. – feralgeometry Jul 29 '21 at 10:51
  • 1
    @feralgeometry They are only for EC2-type tasks, not fargate. I added this to answer. – Marcin Jul 29 '21 at 11:07