CLI로 PutInventory 사용 - AWS Systems Manager

CLI로 PutInventory 사용

다음 코드 예제는 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를 참조하세요.

AWS SDK 개발자 가이드 및 코드 예시의 전체 목록은 AWS SDK와 함께 이 서비스 사용 섹션을 참조하세요. 이 주제에는 시작하기에 대한 정보와 이전 SDK 버전에 대한 세부 정보도 포함되어 있습니다.