Amazon ECS:任务定义不支持 launch_type FARGATE

Aug*_*ero 7 amazon-web-services amazon-ecs aws-cli

我有一个在 AWS ECS 中运行的 Fargate 应用程序,我正在尝试通过 AWS CLI (aws-cli/1.16.96 Python/2.7.15 Darwin/18.0.0 botocore/1.12.86 ) 更新该应用程序。

我已经成功构建并推送了图像,并创建了新的任务定义版本。

当我尝试使用以下命令更新服务时:

aws ecs update-service 
    --cluster cluster-winquest-qa 
    --service container-qa-ge-service 
    --desired-count 0
Run Code Online (Sandbox Code Playgroud)
aws ecs update-service 
    --cluster cluster-qa 
    --service container-service 
    --task-definition first-run-task-definition:5 
    --platform-version "LATEST"  
    --desired-count 1
Run Code Online (Sandbox Code Playgroud)

抛出以下错误消息:

An error occurred (InvalidParameterException) when calling the UpdateService operation: Task definition does not support launch_type FARGATE
Run Code Online (Sandbox Code Playgroud)

然后我尝试将 --launch-type "FARGATE" 添加到上述命令中,构建以下命令:

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
Run Code Online (Sandbox Code Playgroud)

它抛出: Unknown options: --launch-type, FARGATE

我知道错误消息表明 Fargate 应用程序不支持任务定义,但我想知道如何使用 AWS CLI 将服务更新到最新的任务定义版本。我将不胜感激任何帮助。谢谢。

Aug*_*ero 5

我解决了。问题是我如何创建新版本的任务定义,我必须配置requiresCompatibilities参数来指定它。

我使用了这个文档: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_AWSCLI_Fargate.html