Search code examples
amazon-web-servicesaws-cliamazon-ecs

Amazon ECS: Task definition does not support launch_type FARGATE


I have a Fargate app running in AWS ECS, which I'm trying to update by the AWS CLI (aws-cli/1.16.96 Python/2.7.15 Darwin/18.0.0 botocore/1.12.86 ).

I've built and pushed the image successfully, and created a new task definition version.

When I'm trying to update the service with the following commands :

aws ecs update-service 
    --cluster cluster-winquest-qa 
    --service container-qa-ge-service 
    --desired-count 0
aws ecs update-service 
    --cluster cluster-qa 
    --service container-service 
    --task-definition first-run-task-definition:5 
    --platform-version "LATEST"  
    --desired-count 1

Throws the following error message :

An error occurred (InvalidParameterException) when calling the UpdateService operation: Task definition does not support launch_type FARGATE

Then I tried to add --launch-type "FARGATE" to the command above mentioned, building the following command :

aws ecs update-service 
    --cluster cluster-qa 
    --service container-service 
    --task-definition first-run-task-definition:5 
    --platform-version "LATEST" 
    --launch-type "FARGATE"  
    --desired-count 1

It throws : Unknown options: --launch-type, FARGATE

I know that the error mesage said that the task definition is not supported for Fargate apps, but I want to know how can I update the service to the lastest task definition version using AWS CLI. I would appreciate any help. Thanks.


Solution

  • I solved it. The problem was how I was creating the new version of the task definition, there I had to configure requiresCompatibilities param to specify it.

    I used this doc: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_AWSCLI_Fargate.html