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

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

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

PutInventoryOR와 함께 사용 AWS SDK CLI

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

CLI
AWS CLI

인스턴스에 사용자 지정 메타데이터를 할당하는 방법

이번 예에서는 인스턴스에 랙 위치 정보를 할당합니다. 명령이 성공해도 출력은 없습니다.

명령(Linux):

aws ssm put-inventory --instance-id "i-016648b75dd622dab" --items '[{"TypeName": "Custom:RackInfo","SchemaVersion": "1.0","CaptureTime": "2019-01-22T10:01:01Z","Content":[{"RackLocation": "Bay B/Row C/Rack D/Shelf E"}]}]'

명령(Windows):

aws ssm put-inventory --instance-id "i-016648b75dd622dab" --items "TypeName=Custom:RackInfo,SchemaVersion=1.0,CaptureTime=2019-01-22T10:01:01Z,Content=[{RackLocation='Bay B/Row C/Rack D/Shelf F'}]"
  • 자세한 API 내용은 AWS CLI 명령 PutInventory참조를 참조하십시오.

PowerShell
에 대한 도구 PowerShell

예제 1: 이 예제에서는 인스턴스에 랙 위치 정보를 할당합니다. 명령이 성공해도 출력은 없습니다.

$data = New-Object "System.Collections.Generic.Dictionary[System.String,System.String]" $data.Add("RackLocation", "Bay B/Row C/Rack D/Shelf F") $items = New-Object "System.Collections.Generic.List[System.Collections.Generic.Dictionary[System.String, System.String]]" $items.Add($data) $customInventoryItem = New-Object Amazon.SimpleSystemsManagement.Model.InventoryItem $customInventoryItem.CaptureTime = "2016-08-22T10:01:01Z" $customInventoryItem.Content = $items $customInventoryItem.TypeName = "Custom:TestRackInfo2" $customInventoryItem.SchemaVersion = "1.0" $inventoryItems = @($customInventoryItem) Write-SSMInventory -InstanceId "i-0cb2b964d3e14fd9f" -Item $inventoryItems
  • 자세한 API 내용은 AWS Tools for PowerShell Cmdlet 참조를 참조하십시오 PutInventory.