Aws-cli: Task definition does not support launch_type FARGATE

Created on 4 Mar 2019  路  5Comments  路  Source: aws/aws-cli

Hi everyone,

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 builded and pushed the image successfully, and created a new task definition version also successfully.

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 me 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.

Most helpful comment

For anyone being confused by the thumbs up on @ORESoftware 's comment and it not working for them, that's because the --requires-compatibilities "FARGATE" flag needs to be on the aws ecs register-task-definition command, not the aws ecs update-service command.

All 5 comments

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

How to set requiresCompatibilities with the command line?

something like this?

aws ecs update-service --cluster "$cluster_name"  \
    --service "$service_name" \
    --force-new-deployment \
    --requires-compatibilities 'fargate' \   ## here?
    --task-definition "${task_def_fam}:${new_revision}"

@ORESoftware yes --requires-compatibilities "FARGATE" (check the reference here: https://docs.aws.amazon.com/cli/latest/reference/ecs/register-task-definition.html)

Have a look at the pidMode and memory values for Fargate -- cpu starts on 512:
https://docs.aws.amazon.com/cli/latest/reference/ecs/register-task-definition.html

For anyone being confused by the thumbs up on @ORESoftware 's comment and it not working for them, that's because the --requires-compatibilities "FARGATE" flag needs to be on the aws ecs register-task-definition command, not the aws ecs update-service command.

Was this page helpful?
0 / 5 - 0 ratings