文档 AWS SDK 示例 GitHub 存储库中还有更多 S AWS DK 示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
将 UpdateClusterSettings
与 CLI 配合使用
以下代码示例演示如何使用 UpdateClusterSettings
。
- CLI
-
- AWS CLI
-
修改集群的设置
以下
update-cluster-settings
示例为集default
群启用 CloudWatch 容器见解。aws ecs update-cluster-settings \ --cluster
default
\ --settingsname=containerInsights,value=enabled
输出:
{ "cluster": { "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster", "clusterName": "default", "status": "ACTIVE", "registeredContainerInstancesCount": 0, "runningTasksCount": 0, "pendingTasksCount": 0, "activeServicesCount": 0, "statistics": [], "tags": [], "settings": [ { "name": "containerInsights", "value": "enabled" } ] } }
有关更多信息,请参阅《Amazon ECS 开发人员指南》中的修改账户设置。
-
有关 API 的详细信息,请参阅AWS CLI 命令参考UpdateClusterSettings
中的。
-
- PowerShell
-
- 用于 PowerShell
-
示例 1:此 cmdlet 修改了用于 ECS 集群的设置。
Update-ECSClusterSetting -Cluster "LAB-ECS-CL" -Setting @{Name="containerInsights"; Value="disabled"}
输出:
ActiveServicesCount : 0 Attachments : {} AttachmentsStatus : CapacityProviders : {} ClusterArn : arn:aws:ecs:us-west-2:012345678912:cluster/LAB-ECS-CL ClusterName : LAB-ECS-CL DefaultCapacityProviderStrategy : {} PendingTasksCount : 0 RegisteredContainerInstancesCount : 0 RunningTasksCount : 0 Settings : {containerInsights} Statistics : {} Status : ACTIVE Tags : {}
-
有关 API 的详细信息,请参阅 AWS Tools for PowerShell Cmdlet 参考UpdateClusterSettings中的。
-
ListTasks
UpdateService