本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
開啟 Container Insights
完成下列步驟以開啟 AWS Batch 運算環境的 Container Insights。
- AWS 管理主控台
-
-
開啟 AWS Batch 主控台
。 -
選擇 Environments (環境)。
-
選擇您想要的運算環境。
-
在容器洞見索引標籤上,開啟運算環境的容器洞見。
提示
您可以選取預設間隔來彙總指標或建立自訂間隔。
-
- AWS CLI
-
建立運算環境時啟用 Container Insights
搭配 使用
--ecs-settings參數create-compute-environment,在新的運算環境中啟用 Container Insights。$aws batch create-compute-environment \ --compute-environment-namemy-compute-env\ --type MANAGED \ --state ENABLED \ --ecs-settings containerInsights=ENHANCED \ --compute-resources type=FARGATE,maxvCpus=256,subnets=subnet-a123456b,securityGroupIds=sg-a12b3456containerInsights的有效值為ENABLED、ENHANCED和DISABLED。在現有的運算環境中啟用 Container Insights
使用
update-compute-environment在現有的運算環境中啟用或停用 Container Insights。$aws batch update-compute-environment \ --compute-environmentmy-compute-env\ --ecs-settings containerInsights=ENHANCED驗證 Container Insights 設定
使用
describe-compute-environments來驗證目前的設定。$aws batch describe-compute-environments \ --compute-environmentsmy-compute-env\ --query "computeEnvironments[0].ecsSettings"以下顯示啟用 Container Insights 時的輸出。
{ "containerInsights": "ENHANCED" }注意
如果從未在運算環境中設定 Container Insights,則回應中沒有
ecsSettings欄位。 - API
-
在 CreateComputeEnvironment 或 UpdateComputeEnvironment 請求中使用
ecsSettings參數。使用 Container Insights 建立運算環境
包含在請求內文
ecsSettings中:{ "computeEnvironmentName": "my-compute-env", "type": "MANAGED", "state": "ENABLED", "ecsSettings": { "containerInsights": "ENHANCED" }, "computeResources": { "type": "FARGATE", "maxvCpus": 256, "subnets": ["subnet-a123456b"], "securityGroupIds": ["sg-a12b3456"] } }在現有的運算環境中更新 Container Insights
{ "computeEnvironment": "my-compute-env", "ecsSettings": { "containerInsights": "ENHANCED" } }如需詳細資訊,請參閱 AWS Batch API 參考中的 CreateComputeEnvironment 和 UpdateComputeEnvironment。
重要
在運算環境中設定 Container Insights 值後,您無法還原為預設 (取消設定) 行為,其中 Container Insights 設定是在 外部管理 AWS Batch。若要變更 Container Insights 模式,您必須UpdateComputeEnvironment使用新值呼叫 。
這也表示如果您在 CloudFormation 範本中設定此屬性,堆疊復原就無法將設定還原為先前的取消設定狀態。