将 DescribeEffectiveInstanceAssociations 与 CLI 配合使用 - AWS Systems Manager

• AWS Systems Manager Change Manager 不再向新客户开放。现有客户可以继续正常使用该服务。有关更多信息,请参阅 AWS Systems Manager Change Manager 可用性变更

 

• AWS Systems Manager CloudWatch 控制面板在 2026 年 4 月 30 日之后将不再可用。客户可以像现在一样继续使用 Amazon CloudWatch 控制台来查看、创建和管理其 Amazon CloudWatch 控制面板。有关更多信息,请参阅 Amazon CloudWatch 控制面板文档

DescribeEffectiveInstanceAssociations 与 CLI 配合使用

以下代码示例演示如何使用 DescribeEffectiveInstanceAssociations

CLI
AWS CLI

获取实例有效关联的详细信息

以下 describe-effective-instance-associations 示例检索有关实例有效关联的详细信息。

命令:

aws ssm describe-effective-instance-associations --instance-id "i-1234567890abcdef0"

输出:

{ "Associations": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "InstanceId": "i-1234567890abcdef0", "Content": "{\n \"schemaVersion\": \"1.2\",\n \"description\": \"Update the Amazon SSM Agent to the latest version or specified version.\",\n \"parameters\": {\n \"version\": {\n \"default\": \"\",\n \"description\": \"(Optional) A specific version of the Amazon SSM Agent to install. If not specified, the agent will be updated to the latest version.\",\n \"type\": \"String\"\n },\n \"allowDowngrade\": {\n \"default\": \"false\",\n \"description\": \"(Optional) Allow the Amazon SSM Agent service to be downgraded to an earlier version. If set to false, the service can be upgraded to newer versions only (default). If set to true, specify the earlier version.\",\n \"type\": \"String\",\n \"allowedValues\": [\n \"true\",\n \"false\"\n ]\n }\n },\n \"runtimeConfig\": {\n \"aws:updateSsmAgent\": {\n \"properties\": [\n {\n \"agentName\": \"amazon-ssm-agent\",\n \"source\": \"https://s3.{Region}.amazonaws.com/amazon-ssm-{Region}/ssm-agent-manifest.json\",\n \"allowDowngrade\": \"{{ allowDowngrade }}\",\n \"targetVersion\": \"{{ version }}\"\n }\n ]\n }\n }\n}\n", "AssociationVersion": "1" } ] }
PowerShell
适用于 PowerShell V4 的工具

示例 1:此示例描述实例的有效关联。

Get-SSMEffectiveInstanceAssociationList -InstanceId "i-0000293ffd8c57862" -MaxResult 5

输出

AssociationId Content ------------- ------- d8617c07-2079-4c18-9847-1655fc2698b0 {...

示例 2:此示例显示实例有效关联的内容。

(Get-SSMEffectiveInstanceAssociationList -InstanceId "i-0000293ffd8c57862" -MaxResult 5).Content

输出

{ "schemaVersion": "1.2", "description": "Update the Amazon SSM Agent to the latest version or specified version.", "parameters": { "version": { "default": "", "description": "(Optional) A specific version of the Amazon SSM Agent to install. If not specified, the agen t will be updated to the latest version.", "type": "String" }, "allowDowngrade": { "default": "false", "description": "(Optional) Allow the Amazon SSM Agent service to be downgraded to an earlier version. If set to false, the service can be upgraded to newer versions only (default). If set to true, specify the earlier version.", "type": "String", "allowedValues": [ "true", "false" ] } }, "runtimeConfig": { "aws:updateSsmAgent": { "properties": [ { "agentName": "amazon-ssm-agent", "source": "https://s3.{Region}.amazonaws.com/amazon-ssm-{Region}/ssm-agent-manifest.json", "allowDowngrade": "{{ allowDowngrade }}", "targetVersion": "{{ version }}" } ] } } }
适用于 PowerShell V5 的工具

示例 1:此示例描述实例的有效关联。

Get-SSMEffectiveInstanceAssociationList -InstanceId "i-0000293ffd8c57862" -MaxResult 5

输出

AssociationId Content ------------- ------- d8617c07-2079-4c18-9847-1655fc2698b0 {...

示例 2:此示例显示实例有效关联的内容。

(Get-SSMEffectiveInstanceAssociationList -InstanceId "i-0000293ffd8c57862" -MaxResult 5).Content

输出

{ "schemaVersion": "1.2", "description": "Update the Amazon SSM Agent to the latest version or specified version.", "parameters": { "version": { "default": "", "description": "(Optional) A specific version of the Amazon SSM Agent to install. If not specified, the agen t will be updated to the latest version.", "type": "String" }, "allowDowngrade": { "default": "false", "description": "(Optional) Allow the Amazon SSM Agent service to be downgraded to an earlier version. If set to false, the service can be upgraded to newer versions only (default). If set to true, specify the earlier version.", "type": "String", "allowedValues": [ "true", "false" ] } }, "runtimeConfig": { "aws:updateSsmAgent": { "properties": [ { "agentName": "amazon-ssm-agent", "source": "https://s3.{Region}.amazonaws.com/amazon-ssm-{Region}/ssm-agent-manifest.json", "allowDowngrade": "{{ allowDowngrade }}", "targetVersion": "{{ version }}" } ] } } }

有关 AWS SDK 开发人员指南和代码示例的完整列表,请参阅 将此服务与 AWS SDK 结合使用 本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。