amazon-web-services - AWS CLI:ECS register-task-definition 和 requires-compatabilies 选项
问题描述
我正在尝试调整我的 CircleCI 配置文件以将我的 node.js 应用程序构建为 Docker 映像并将其部署到 AWS ECS。我从 ricktbaker 的这个 config.yml文件开始,我试图让它在 Fargate 上工作。
当我最初在 CircleCI 中运行这些更改时,我收到了这个错误:
调用 UpdateService 操作时发生错误 (InvalidParameterException):任务定义不支持 launch_type FARGATE。
看起来我应该能够使用requires-compatibilities
更改任务定义注册方式的选项来修改第 71 行,但我一直收到一个我无法弄清楚的错误。
json=$(aws ecs register-task-definition --container-definitions "$task_def" --family "$FAMILY" --requires-compatibilities "FARGATE")
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
我是否错误地添加了选项?它似乎与AWS 的文档相匹配……谢谢,任何提示。
我也尝试添加该debug
选项,但我在日志中没有看到任何特别有用的内容(略过编辑,如下)。
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>>
解决方案
您的命令行格式是正确的,即register-task-definition --requires-compatibilities "FARGATE"
因为 Fargate 是相当新的。因此,您可能必须确保这awscli
是最新版本。
你安装的awscli
版本是什么?最新版本是1.16.123
而且,推荐的方式pip3 install awscli --upgrade --user
希望这可以帮助。
推荐阅读
- .htaccess - .htaccess 使用 RewriteCond% {TIME} 重定向特定文件夹
- xcode - 安装 Cocoapods 的问题
- javascript - Chrome扩展弹出页面滚动在mac os上不起作用
- python - 如何不拆分字符串以检索用户名,但不拆分包含无效字符的用户名
- axios - 编码为等待时,forEach 正在运行请求
- puppeteer - 有没有办法从 Puppeteer 点击地址栏中的“站点信息”按钮?
- json - 使用 SuperObject 获取键值时缺少 JSON 键如何处理?
- css - 发布时 Wordpress 不居中对齐图像
- roc - 如何计算负类的精确召回率、ROC 和 f1 分数?
- xml - Spoon PDI 中的 XML 输入