本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 AWS Panorama 管理设备 API
您可以使用 AWS Panorama 自动执行设备管理任务API。
查看设备
要获取带有设备的设备列表IDs,请使用ListDevicesAPI。
$
aws panorama list-devices
"Devices": [ { "DeviceId": "device-4tafxmplhtmzabv5lsacba4ere", "Name": "my-appliance", "CreatedTime": 1652409973.613, "ProvisioningStatus": "SUCCEEDED", "LastUpdatedTime": 1652410973.052, "LeaseExpirationTime": 1652842940.0 } ] }
要获取有关设备的更多详细信息,请使用DescribeDeviceAPI。
$
aws panorama describe-device --device-id device-4tafxmplhtmzabv5lsacba4ere
{ "DeviceId": "device-4tafxmplhtmzabv5lsacba4ere", "Name": "my-appliance", "Arn": "arn:aws:panorama:us-west-2:123456789012:device/device-4tafxmplhtmzabv5lsacba4ere", "Type": "PANORAMA_APPLIANCE", "DeviceConnectionStatus": "ONLINE", "CreatedTime": 1648232043.421, "ProvisioningStatus": "SUCCEEDED", "LatestSoftware": "4.3.55", "CurrentSoftware": "4.3.45", "SerialNumber": "GFXMPL0013023708", "Tags": {}, "CurrentNetworkingStatus": { "Ethernet0Status": { "IpAddress": "192.168.0.1/24", "ConnectionStatus": "CONNECTED", "HwAddress": "8C:XM:PL:60:C5:88" }, "Ethernet1Status": { "IpAddress": "--", "ConnectionStatus": "NOT_CONNECTED", "HwAddress": "8C:XM:PL:60:C5:89" } }, "LeaseExpirationTime": 1652746098.0 }
升级设备软件
如果 LatestSoftware
版本比 CurrentSoftware
版本新,您可以升级设备。CreateJobForDevicesAPI使用创建 over-the-air (OTA) 更新任务。
注意
任何超过 8.0.29 的更新都将意味着 Sagemaker Neo 模型节点无法运行。如果您当前使用的是模型节点,GPU则建议使用直接硬件访问来直接在上运行模型,或者选择不升级。更新 8.0. AWS 29 之后使用 Panorama有关更新后如何处理应用程序的更多信息,请参阅。
$
aws panorama create-job-for-devices --device-ids device-4tafxmplhtmzabv5lsacba4ere \ --device-job-config '{"OTAJobConfig": {"ImageVersion": "
{ "Jobs": [ { "JobId": "device-4tafxmplhtmzabv5lsacba4ere-0", "DeviceId": "device-4tafxmplhtmzabv5lsacba4ere" } ] }4.3.55
"}}' --job-type OTA
在脚本中,可以使用 Bash 字符串操作填充作业配置文件中的映像版本字段。
例 check-updates.sh
apply_update() { DEVICE_ID=$1 NEW_VERSION=$2 CONFIG='{"OTAJobConfig": {"ImageVersion": "NEW_VERSION"}}' CONFIG=
${CONFIG/NEW_VERSION/$NEW_VERSION}
aws panorama create-job-for-devices --device-ids ${DEVICE_ID} --device-job-config "${CONFIG}" --job-type OTA }
设备将下载指定的软件版本并自行更新。使用观看更新进度DescribeDeviceJobAPI。
$
aws panorama describe-device-job --job-id device-4tafxmplhtmzabv5lsacba4ere-0
{ "JobId": "device-4tafxmplhtmzabv5lsacba4ere-0", "DeviceId": "device-4tafxmplhtmzabv5lsacba4ere", "DeviceArn": "arn:aws:panorama:us-west-2:559823168634:device/device-4tafxmplhtmzabv5lsacba4ere", "DeviceName": "my-appliance", "DeviceType": "PANORAMA_APPLIANCE", "ImageVersion": "4.3.55", "Status": "REBOOTING", "CreatedTime": 1652410232.465 }
要获取所有正在运行的作业的列表,请使用ListDevicesJobs。
$
aws panorama list-devices-jobs
{ "DeviceJobs": [ { "DeviceName": "my-appliance", "DeviceId": "device-4tafxmplhtmzabv5lsacba4ere", "JobId": "device-4tafxmplhtmzabv5lsacba4ere-0", "CreatedTime": 1652410232.465 } ] }
有关检查和应用更新的示例脚本,请参阅本指南 GitHub 存储库中的 check-updates.sh
重新启动设备
要重新启动设备,请使用CreateJobForDevicesAPI。
$
aws panorama create-job-for-devices --device-ids device-4tafxmplhtmzabv5lsacba4ere --job-type REBOOT
{ "Jobs": [ { "JobId": "device-4tafxmplhtmzabv5lsacba4ere-0", "DeviceId": "device-4tafxmplhtmzabv5lsacba4ere" } ] }
在脚本中,您可以获取设备列表,并选择一个设备以交互方式重新启动。
例 reboot-device.sh – 用法
$
./reboot-device.sh
Getting devices... 0: device-53amxmplyn3gmj72epzanacniy my-se70-1 1: device-6talxmpl5mmik6qh5moba6jium my-manh-24 Choose a device1
Reboot device device-6talxmpl5mmik6qh5moba6jium? (y/n)y
{ "Jobs": [ { "DeviceId": "device-6talxmpl5mmik6qh5moba6jium", "JobId": "device-6talxmpl5mmik6qh5moba6jium-8" } ] }