Amazon web services AWS CLI:ECS注册任务定义和要求兼容性选项

Amazon web services AWS CLI:ECS注册任务定义和要求兼容性选项,amazon-web-services,aws-cli,amazon-ecs,circleci,aws-fargate,Amazon Web Services,Aws Cli,Amazon Ecs,Circleci,Aws Fargate,我正在尝试调整CircleCI配置文件,将node.js应用程序构建为Docker映像,并将其部署到AWS ECS。我从ricktbaker的文件开始,我正在努力使它在Fargate上工作 当我最初在CircleCI中运行这些更改时,我遇到了以下错误: 调用UpdateService操作时发生错误(InvalidParameterException):任务定义不支持启动类型FARGATE。 看起来我应该能够使用要求兼容性选项修改第71行,以更改任务定义的注册方式,但我一直遇到一个无法理解的错误

我正在尝试调整CircleCI配置文件,将node.js应用程序构建为Docker映像,并将其部署到AWS ECS。我从ricktbaker的文件开始,我正在努力使它在Fargate上工作

当我最初在CircleCI中运行这些更改时,我遇到了以下错误:

调用UpdateService操作时发生错误(InvalidParameterException):任务定义不支持启动类型FARGATE。

看起来我应该能够使用
要求兼容性
选项修改第71行,以更改任务定义的注册方式,但我一直遇到一个无法理解的错误

json=$(aws ecs register-task-definition --container-definitions "$task_def" --family "$FAMILY" --requires-compatibilities "FARGATE")

您的命令行格式正确,即
注册任务定义--需要兼容性“FARGATE”
因为法尔盖特是新来的。因此,您可能必须确保
awscli
是最新版本

您安装的
awscli
版本是什么?最新版本是
1.16.123

而且,推荐的方法是
pip3安装awscli--upgrade--user


希望这有帮助。

使用
--user
时需要注意的事项:它将
aws
安装在
~/.local
的文件夹中。然后确保此文件夹位于您的
$PATH
中。
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: --requires-compatibilities, FARGATE
2019-03-13 03:05:45,948 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.11.76 Python/2.7.15 Linux/4.4.0-141-generic botocore/1.5.39
2019-03-13 03:05:45,948 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['ecs', 'register-task-definition', '--container-definitions', 'MYCONTAINERDEFINITION', '--family', 'MYTASKNAME', '--debug', '--requires-compatibilities', 'FARGATE']
2019-03-13 03:05:45,948 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x7fd7e93fbb90>
2019-03-13 03:05:45,948 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x7fd7e985d398>
2019-03-13 03:05:45,949 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/lib/python2.7/site-packages/botocore/data/ecs/2014-11-13/service-2.json
2019-03-13 03:05:45,962 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.ecs: calling handler <function register_retries_for_service at 0x7fd7ea57ecf8>
2019-03-13 03:05:45,962 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: ecs
2019-03-13 03:05:45,963 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ecs: calling handler <function add_waiters at 0x7fd7e9381d70>
2019-03-13 03:05:45,966 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/lib/python2.7/site-packages/botocore/data/ecs/2014-11-13/waiters-2.json
2019-03-13 03:05:45,967 - MainThread - awscli.clidriver - DEBUG - OrderedDict([(u'family', <awscli.arguments.CLIArgument object at 0x7fd7e8f066d0>), (u'task-role-arn', <awscli.arguments.CLIArgument object at 0x7fd7e8f06950>), (u'network-mode', <awscli.arguments.CLIArgument object at 0x7fd7e8f06990>), (u'container-definitions', <awscli.arguments.ListArgument object at 0x7fd7e8f069d0>), (u'volumes', <awscli.arguments.ListArgument object at 0x7fd7e8f06a10>), (u'placement-constraints', <awscli.arguments.ListArgument object at 0x7fd7e8f06a50>)])
2019-03-13 03:05:45,967 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ecs.register-task-definition: calling handler <function add_streaming_output_arg at 0x7fd7e9381140>
2019-03-13 03:05:45,968 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ecs.register-task-definition: calling handler <function add_cli_input_json at 0x7fd7e98661b8>
2019-03-13 03:05:45,968 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ecs.register-task-definition: calling handler <function unify_paging_params at 0x7fd7e9402ed8>
2019-03-13 03:05:45,971 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/lib/python2.7/site-packages/botocore/data/ecs/2014-11-13/paginators-1.json
2019-03-13 03:05:45,972 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ecs.register-task-definition: calling handler <function add_generate_skeleton at 0x7fd7e947e320>
2019-03-13 03:05:45,972 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.ecs.register-task-definition: calling handler <bound method CliInputJSONArgument.override_required_args of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x7fd7e8f06a90>>
2019-03-13 03:05:45,972 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.ecs.register-task-definition: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x7fd7e8f1e890>>