Fargate

AWS Fargate

[8] AWS Fargate は, ECS の機能です。

概要

[1] AWS Fargate のご紹介 () https://aws.amazon.com/jp/about-aws/whats-new/2017/11/introducing-aws-fargate-a-technology-to-run-containers-without-managing-infrastructure/

[2] AWS Fargateとは? - Qiita () https://qiita.com/riywo/items/1a5b50028542d9bb06cc

[3] AWS Fargate – サーバーやクラスターの管理が不要なコンテナの実行 () https://aws.amazon.com/jp/fargate/?sc_channel=PS&sc_campaign=acquisition_JP&sc_publisher=google&sc_medium=fargate_b&sc_content=fargate_e&sc_detail=fargate&sc_category=fargate&sc_segment=241388692036&sc_matchtype=e&sc_country=JP&sc_brand=brand&ef_id=WcTjRAAAARd0j29e:20180120073341:s

東京リージョン

[4] AWS Fargate の 東京リージョン対応予定がアナウンスされました | Amazon Web Services ブログ () https://aws.amazon.com/jp/blogs/news/aws-fargate-tokyo-launch/

[5] AWS Fargate 東京リージョン サービス開始のお知らせ | Amazon Web Services ブログ () https://aws.amazon.com/jp/blogs/news/aws-fargate-tokyo/

awscli の Fargate 対応

[6]

Parameter validation failed:
Unknown parameter in input: "requiresCompatibilities", must be one of: family, taskRoleArn, networkMode, containerDefinitions, volumes, placementConstraints
Unknown parameter in input: "executionRoleArn", must be one of: family, taskRoleArn, networkMode, containerDefinitions, volumes, placementConstraints
Unknown parameter in input: "memory", must be one of: family, taskRoleArn, networkMode, containerDefinitions, volumes, placementConstraints
Unknown parameter in input: "cpu", must be one of: family, taskRoleArn, networkMode, containerDefinitions, volumes, placementConstraints
Unknown parameter in containerDefinitions[0]: "healthCheck", must be one of: name, image, cpu, memory, memoryReservation, links, portMappings, essential, entryPoint, command, environment, mountPoints, volumesFrom, linuxParameters, hostname, user, workingDirectory, disableNetworking, privileged, readonlyRootFilesystem, dnsServers, dnsSearchDomains, extraHosts, dockerSecurityOptions, dockerLabels, ulimits, logConfiguration

この awscli のエラーは、 Fargate 未対応という意味です。

[7] プラットフォームによっては提供されている awscli が極めて古く、 Fargate が登場して何年も経つ未だにこのエラーに遭遇することがあります。 awscli を最新化すれば解消します。

Fargate Spot

[10] AWS Fargate キャパシティープロバイダー - Amazon ECS, , https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/userguide/fargate-capacity-providers.html

[13] put-cluster-capacity-providers — AWS CLI 1.22.89 Command Reference, , https://docs.aws.amazon.com/cli/latest/reference/ecs/put-cluster-capacity-providers.html

[9] Fargateをスポットで7割引で使うFargate Spotとは? #reinvent | DevelopersIO, 濱田孝治, https://dev.classmethod.jp/articles/fargate-spot-detail/

[12] Fargate Spot 登場以前に作成した cluster で Spot を使う方法: 古い cluster は 「デフォルトのキャパシティープロバイダー戦略」 に 「FARGATE」 「FARGATE_SPOT」が出てきません。

>>9 には新しい cluster を作れば古い cluster にも選択肢が出てくるようなことが書かれていますが、 本段落執筆時点ではそうなりません。(新しい cluster でだけしか出てきません。)

>>10 には Web からは設定できず、初回は AWS CLI を使うしかないと説明されています。 ところがそこに書かれている通りに実行してもエラーになります。

>>13 によると、本段落執筆時点で最新の方法はこうです (動作確認しました):

aws ecs put-cluster-capacity-providers \
    --cluster cluster-name \
    --capacity-providers FARGATE FARGATE_SPOT \
    --default-capacity-provider-strategy capacityProvider=FARGATE,weight=1 \
    --region region

(1回実行すれば次から Web で設定できるようになるので、 --default-capacity-provider-strategy は適当で良い。)

メモ