以下代码示例演示如何使用 PutInventory
。
- 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 Command Reference》中的 PutInventory
。
-
有关 AWS SDK 开发人员指南和代码示例的完整列表,请参阅 将此服务与 AWS SDK 结合使用。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。