😸

既存のAmazon ECSクラスタでContainer Insightsを有効にする

2022/07/17に公開

はじめに

この設定をしようとすると毎回調べることになるので、いつもの手順をメモ。

環境

  • aws-cli 2.7.2

Container Insightsを有効にする

  • 現在の設定を確認する
$ aws ecs describe-clusters \
  --cluster {clusterName} \
  --include SETTINGS

{
    "clusters": [
        {
            "clusterArn": "arn:aws:ecs:***",
            "clusterName": "{clusterName}",
            "status": "ACTIVE",
            "registeredContainerInstancesCount": 0,
            "runningTasksCount": 1,
            "pendingTasksCount": 0,
            "activeServicesCount": 1,
            "statistics": [],
            "tags": [],
            "settings": [
                {
                    "name": "containerInsights",
                    "value": "disabled"
                }
            ],
            "capacityProviders": [
                "FARGATE",
                "FARGATE_SPOT"
            ],
            "defaultCapacityProviderStrategy": []
        }
    ],
    "failures": []
}
  • Container Insightsを有効にする
$ aws ecs update-cluster-settings \
  --cluster {clusterName} \
  --settings name=containerInsights,value=enabled

{
    "cluster": {
        "clusterArn": "arn:aws:ecs:***",
        "clusterName": "{clusterName}",
        "status": "ACTIVE",
        "registeredContainerInstancesCount": 0,
        "runningTasksCount": 0,
        "pendingTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "tags": [],
        "settings": [
            {
                "name": "containerInsights",
                "value": "enabled"
            }
        ],
        "capacityProviders": [
            "FARGATE",
            "FARGATE_SPOT"
        ],
        "defaultCapacityProviderStrategy": [],
        "attachments": [],
        "attachmentsStatus": "UPDATE_COMPLETE"
    }
}
  • 設定が有効になったことを確認する
$ aws ecs describe-clusters \
  --cluster {clusterName} \
  --include SETTINGS

{
    "clusters": [
        {
            "clusterArn": "arn:aws:ecs:***",
            "clusterName": "{clusterName}",
            "status": "ACTIVE",
            "registeredContainerInstancesCount": 0,
            "runningTasksCount": 1,
            "pendingTasksCount": 0,
            "activeServicesCount": 1,
            "statistics": [],
            "tags": [],
            "settings": [
                {
                    "name": "containerInsights",
                    "value": "enabled"
                }
            ],
            "capacityProviders": [
                "FARGATE",
                "FARGATE_SPOT"
            ],
            "defaultCapacityProviderStrategy": []
        }
    ],
    "failures": []
}

まとめ

既存のAmazon ECSクラスタでContainer Insightsを有効にする場合の、AWS CLIでの設定手順をまとめました。

参考

GitHubで編集を提案

Discussion

ログインするとコメントできます