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

UpdateAssociationStatus 与 CLI 配合使用

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

CLI
AWS CLI

更新关联状态

以下 update-association-status 示例更新了实例和文档之间关联的关联状态。

aws ssm update-association-status \ --name "AWS-UpdateSSMAgent" \ --instance-id "i-1234567890abcdef0" \ --association-status "Date=1424421071.939,Name=Pending,Message=temp_status_change,AdditionalInfo=Additional-Config-Needed"

输出:

{ "AssociationDescription": { "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-1234567890abcdef0", "AssociationVersion": "1", "Date": 1550507529.604, "LastUpdateAssociationDate": 1550507806.974, "Status": { "Date": 1424421071.0, "Name": "Pending", "Message": "temp_status_change", "AdditionalInfo": "Additional-Config-Needed" }, "Overview": { "Status": "Success", "AssociationStatusAggregatedCount": { "Success": 1 } }, "DocumentVersion": "$DEFAULT", "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "Targets": [ { "Key": "InstanceIds", "Values": [ "i-1234567890abcdef0" ] } ], "LastExecutionDate": 1550507808.0, "LastSuccessfulExecutionDate": 1550507808.0 } }

有关更多信息,请参阅《AWS Systems Manager 用户指南》中的在 Systems Manager 中使用关联

PowerShell
适用于 PowerShell 的工具

示例 1:此示例更新实例与配置文档之间关联的关联状态。

Update-SSMAssociationStatus -Name "AWS-UpdateSSMAgent" -InstanceId "i-0000293ffd8c57862" -AssociationStatus_Date "2015-02-20T08:31:11Z" -AssociationStatus_Name "Pending" -AssociationStatus_Message "temporary_status_change" -AssociationStatus_AdditionalInfo "Additional-Config-Needed"

输出:

Name : AWS-UpdateSSMAgent InstanceId : i-0000293ffd8c57862 Date : 2/23/2017 6:55:22 PM Status.Name : Pending Status.Date : 2/20/2015 8:31:11 AM Status.Message : temporary_status_change Status.AdditionalInfo : Additional-Config-Needed
  • 有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference》中的 UpdateAssociationStatus

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