DescribeMaintenanceWindowTargetsOR와 함께 사용 AWS SDK CLI - AWS SDK코드 예제

AWS 문서 AWS SDK SDK 예제 GitHub 리포지토리에 더 많은 예제가 있습니다.

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

DescribeMaintenanceWindowTargetsOR와 함께 사용 AWS SDK CLI

다음 코드 예제는 DescribeMaintenanceWindowTargets의 사용 방법을 보여 줍니다.

CLI
AWS CLI

예제 1: 유지 관리 기간의 모든 대상을 나열하는 방법

다음 describe-maintenance-window-targets 예제에서는 유지 관리 기간의 모든 대상을 나열합니다.

aws ssm describe-maintenance-window-targets \ --window-id "mw-06cf17cbefEXAMPLE"

출력:

{ "Targets": [ { "ResourceType": "INSTANCE", "OwnerInformation": "Single instance", "WindowId": "mw-06cf17cbefEXAMPLE", "Targets": [ { "Values": [ "i-0000293ffdEXAMPLE" ], "Key": "InstanceIds" } ], "WindowTargetId": "350d44e6-28cc-44e2-951f-4b2c9EXAMPLE" }, { "ResourceType": "INSTANCE", "OwnerInformation": "Two instances in a list", "WindowId": "mw-06cf17cbefEXAMPLE", "Targets": [ { "Values": [ "i-0000293ffdEXAMPLE", "i-0cb2b964d3EXAMPLE" ], "Key": "InstanceIds" } ], "WindowTargetId": "e078a987-2866-47be-bedd-d9cf4EXAMPLE" } ] }

예제 2: 특정 소유자 정보 값과 일치하는 유지 관리 기간의 대상을 나열하는 방법

describe-maintenance-window-targets 예제에서는 특정 값이 있는 유지 관리 기간의 모든 대상을 나열합니다.

aws ssm describe-maintenance-window-targets \ --window-id "mw-0ecb1226ddEXAMPLE" \ --filters "Key=OwnerInformation,Values=CostCenter1"

출력:

{ "Targets": [ { "WindowId": "mw-0ecb1226ddEXAMPLE", "WindowTargetId": "da89dcc3-7f9c-481d-ba2b-edcb7d0057f9", "ResourceType": "INSTANCE", "Targets": [ { "Key": "tag:Environment", "Values": [ "Prod" ] } ], "OwnerInformation": "CostCenter1", "Name": "ProdTarget1" } ] }

자세한 내용은 AWS Systems Manager 사용 설명서의 Windows (AWS CLI) 유지 관리에 대한 정보 보기를 참조하십시오.

PowerShell
도구: PowerShell

예제 1: 이 예제에서는 유지 관리 기간의 모든 대상을 나열합니다.

Get-SSMMaintenanceWindowTarget -WindowId "mw-06cf17cbefcb4bf4f"

출력:

OwnerInformation : Single instance ResourceType : INSTANCE Targets : {InstanceIds} WindowId : mw-06cf17cbefcb4bf4f WindowTargetId : 350d44e6-28cc-44e2-951f-4b2c985838f6 OwnerInformation : Two instances in a list ResourceType : INSTANCE Targets : {InstanceIds} WindowId : mw-06cf17cbefcb4bf4f WindowTargetId : e078a987-2866-47be-bedd-d9cf49177d3a