[8] 
[DFN[AWS Fargate]] は,
[[ECS]]
の機能です。

* 概要

[1] [CITE@ja-JP[AWS Fargate のご紹介]]
([TIME[2017-12-02 11:11:44 +09:00]])
<https://aws.amazon.com/jp/about-aws/whats-new/2017/11/introducing-aws-fargate-a-technology-to-run-containers-without-managing-infrastructure/>

[2] [CITE[AWS Fargateとは? - Qiita]]
([TIME[2017-12-12 14:17:45 +09:00]])
<https://qiita.com/riywo/items/1a5b50028542d9bb06cc>

[3] [CITE@ja-JP[AWS Fargate – サーバーやクラスターの管理が不要なコンテナの実行]]
([TIME[2018-01-18 11:05:07 +09:00]])
<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] [CITE@ja-JP[AWS Fargate の 東京リージョン対応予定がアナウンスされました | Amazon Web Services ブログ]]
([TIME[2018-06-01 11:27:55 +09:00]])
<https://aws.amazon.com/jp/blogs/news/aws-fargate-tokyo-launch/>

[5] [CITE@ja-JP[AWS Fargate 東京リージョン サービス開始のお知らせ | Amazon Web Services ブログ]]
([TIME[2018-07-04 14:16:06 +09:00]])
<https://aws.amazon.com/jp/blogs/news/aws-fargate-tokyo/>

* [CODE[awscli]] の Fargate 対応

[6] 
[PRE(code)[
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
]PRE]

この [CODE[awscli]]
のエラーは、
[[Fargate]]
未対応という意味です。

[7] 
[[プラットフォーム]]によっては提供されている
[CODE[awscli]]
が極めて古く、
[[Fargate]]
が登場して何年も経つ未だにこのエラーに遭遇することがあります。
[CODE[awscli]]
を最新化すれば解消します。
[TIME[2020-10-21T01:38:46.400Z]]

* Fargate Spot

[10] [CITE[[[AWS Fargate]] キャパシティープロバイダー - Amazon ECS]], [TIME[2022-04-04T01:53:12.000Z]], [TIME[2022-04-06T06:23:53.644Z]] <https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/userguide/fargate-capacity-providers.html>



[13] 
[CITE[put-cluster-capacity-providers — AWS CLI 1.22.89 Command Reference]], [TIME[2022-04-05T19:38:46.000Z]], [TIME[2022-04-06T07:11:52.960Z]] <https://docs.aws.amazon.com/cli/latest/reference/ecs/put-cluster-capacity-providers.html>


[9] [CITE@ja[[[Fargate]]をスポットで7割引で使うFargate Spotとは? #reinvent | DevelopersIO]], [[濱田孝治]], [TIME[2022-04-06T06:23:37.000Z]] <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
によると、本段落執筆時点で最新の方法はこうです (動作確認しました):

[PRE(code)[
aws ecs put-cluster-capacity-providers \
    --cluster [VAR[cluster-name]] \
    --capacity-providers FARGATE FARGATE_SPOT \
    --default-capacity-provider-strategy capacityProvider=FARGATE,weight=1 \
    --region [VAR[region]]
]PRE]

(1回実行すれば次から [[Web]] で設定できるようになるので、
[CODE[--default-capacity-provider-strategy]] は適当で良い。)

* メモ