AWS RoboMaker 使用 的範例 AWS CLI - AWS Command Line Interface

本文件 AWS CLI 僅適用於 的第 1 版。如需與 第 2 版相關的文件 AWS CLI,請參閱 第 2 版使用者指南

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

AWS RoboMaker 使用 的範例 AWS CLI

下列程式碼範例示範如何使用 AWS Command Line Interface 搭配 來執行動作和實作常見案例 AWS RoboMaker。

Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會示範如何呼叫個別服務函數,但您可以在其相關案例中查看內容中的動作。

每個範例都包含完整原始程式碼的連結,您可以在其中找到如何在內容中設定和執行程式碼的指示。

主題

動作

下列程式碼範例示範如何使用 batch-describe-simulation-job

AWS CLI

批次描述模擬任務

下列batch-describe-simulation-job範例會擷取三個指定模擬任務的詳細資訊。

命令:

aws robomaker batch-describe-simulation-job \ --job arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-66bbb3gpxm8x arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-p0cpdrrwng2n arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-g8h6tglmblgw

輸出:

{ "jobs": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-66bbb3gpxm8x", "status": "Completed", "lastUpdatedAt": 1548959178.0, "failureBehavior": "Continue", "clientRequestToken": "6020408e-b05c-4310-9f13-4ed71c5221ed", "outputLocation": { "s3Bucket": "awsrobomakerobjecttracker-111111111-bundlesbucket-2lk584kiq1oa", "s3Prefix": "output" }, "maxJobDurationInSeconds": 3600, "simulationTimeMillis": 0, "iamRole": "arn:aws:iam::111111111111:role/AWSRoboMakerObjectTracker-154895-SimulationJobRole-14D5ASA7PQE3A", "simulationApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/AWSRoboMakerObjectTracker-1548959046124_NPvyfcatq/1548959170096", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "object_tracker_simulation", "launchFile": "local_training.launch", "environmentVariables": { "MARKOV_PRESET_FILE": "object_tracker.py", "MODEL_S3_BUCKET": "awsrobomakerobjecttracker-111111111-bundlesbucket-2lk584kiq1oa", "MODEL_S3_PREFIX": "model-store", "ROS_AWS_REGION": "us-west-2" } } } ], "tags": {}, "vpcConfig": { "subnets": [ "subnet-716dd52a", "subnet-43c22325", "subnet-3f526976" ], "securityGroups": [ "sg-3fb40545" ], "vpcId": "vpc-99895eff", "assignPublicIp": true } }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-p0cpdrrwng2n", "status": "Completed", "lastUpdatedAt": 1548168817.0, "failureBehavior": "Continue", "clientRequestToken": "e4a23e75-f9a7-411d-835f-21881c82c58b", "outputLocation": { "s3Bucket": "awsrobomakercloudwatch-111111111111-bundlesbucket-14e5s9jvwtmv7", "s3Prefix": "output" }, "maxJobDurationInSeconds": 3600, "simulationTimeMillis": 0, "iamRole": "arn:aws:iam::111111111111:role/AWSRoboMakerCloudWatch-154766341-SimulationJobRole-G0OBWTQ8YBG6", "robotApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/AWSRoboMakerCloudWatch-1547663411642_NZbpqEJ3T/1547663517377", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "cloudwatch_robot", "launchFile": "await_commands.launch", "environmentVariables": { "LAUNCH_ID": "1548168752173", "ROS_AWS_REGION": "us-west-2" } } } ], "simulationApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/AWSRoboMakerCloudWatch-1547663411642_0LIt6D1h6/1547663521470", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "cloudwatch_simulation", "launchFile": "bookstore_turtlebot_navigation.launch", "environmentVariables": { "LAUNCH_ID": "1548168752173", "ROS_AWS_REGION": "us-west-2", "TURTLEBOT3_MODEL": "waffle_pi" } } } ], "tags": {}, "vpcConfig": { "subnets": [ "subnet-716dd52a", "subnet-43c22325", "subnet-3f526976" ], "securityGroups": [ "sg-3fb40545" ], "vpcId": "vpc-99895eff", "assignPublicIp": true } }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-g8h6tglmblgw", "status": "Canceled", "lastUpdatedAt": 1546543442.0, "failureBehavior": "Fail", "clientRequestToken": "d796bbb4-2a2c-1abc-f2a9-0d9e547d853f", "outputLocation": { "s3Bucket": "sample-bucket", "s3Prefix": "SimulationLog_115490482698" }, "maxJobDurationInSeconds": 28800, "simulationTimeMillis": 0, "iamRole": "arn:aws:iam::111111111111:role/RoboMakerSampleTheFirst", "robotApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/RoboMakerHelloWorldRobot/1546541208251", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_robot", "launchFile": "rotate.launch" } } ], "simulationApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/RoboMakerHelloWorldSimulation/1546541198985", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_simulation", "launchFile": "empty_world.launch" } } ], "tags": {} } ], "unprocessedJobs": [] }

下列程式碼範例示範如何使用 cancel-simulation-job

AWS CLI

若要取消模擬任務

下列cancel-simulation-job範例會取消指定的模擬任務。

aws robomaker cancel-simulation-job \ --job arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-66bbb3gpxm8x

下列程式碼範例示範如何使用 create-deployment-job

AWS CLI

若要建立部署任務

此範例會為機群 建立部署任務 MyFleet。它包含名為 "ENVIRONMENT" 的環境變數。它還連接名為 "Region" 的標籤。

命令:

aws robomaker create-deployment-job --deployment-config concurrentDeploymentPercentage=20,failureThresholdPercentage=25 --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/Trek/1539894765711 --tags Region=West --deployment-application-configs application=arn:aws:robomaker:us-west-2:111111111111:robot-application/RoboMakerVoiceInteractionRobot/1546537110575,applicationVersion=1,launchConfig={environmentVariables={ENVIRONMENT=Beta},launchFile=await_commands.launch,packageName=voice_interaction_robot}

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/sim-0974h36s4v0t", "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "status": "Pending", "deploymentApplicationConfigs": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/RoboMakerVoiceInteractionRobot/1546537110575", "applicationVersion": "1", "launchConfig": { "packageName": "voice_interaction_robot", "launchFile": "await_commands.launch", "environmentVariables": { "ENVIRONMENT": "Beta" } } } ], "createdAt": 1550770236.0, "deploymentConfig": { "concurrentDeploymentPercentage": 20, "failureThresholdPercentage": 25 }, "tags": { "Region": "West" } }

下列程式碼範例示範如何使用 create-fleet

AWS CLI

若要建立機群

此範例會建立機群。它連接名為 區域的標籤。

命令:

aws robomaker create-fleet --name MyFleet --tags Region=East

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyOtherFleet/1550771394395", "name": "MyFleet", "createdAt": 1550771394.0, "tags": { "Region": "East" } }
  • 如需API詳細資訊,請參閱 命令參考 CreateFleet中的 。 AWS CLI

下列程式碼範例示範如何使用 create-robot-application-version

AWS CLI

建立機器人應用程式版本

此範例會建立機器人應用程式版本。

命令:

aws robomaker create-robot-application-version --application arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551201873931

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551201873931", "name": "MyRobotApplication", "version": "1", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-robot-application.tar.gz", "etag": "f8cf5526f1c6e7b3a72c3ed3f79c5493-70", "architecture": "ARMHF" } ], "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "lastUpdatedAt": 1551201873.0, "revisionId": "9986bb8d-a695-4ab4-8810-9f4a74d1aa00" "tags": {} }

下列程式碼範例示範如何使用 create-robot-application

AWS CLI

建立機器人應用程式

此範例會建立機器人應用程式。

命令:

aws robomaker create-robot-application --name MyRobotApplication --sources s3Bucket=my-bucket,s3Key=my-robot-application.tar.gz,architecture=X86_64 --robot-software-suite name=ROS,version=Kinetic

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551201873931", "name": "MyRobotApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-robot-application.tar.gz", "architecture": "ARMHF" } ], "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "lastUpdatedAt": 1551201873.0, "revisionId": "1f3cb539-9239-4841-a656-d3efcffa07e1", "tags": {} }

下列程式碼範例示範如何使用 create-robot

AWS CLI

建立機器人

此範例會建立機器人。它使用 ARMHF 架構。它還連接名為 區域的標籤。

命令:

aws robomaker create-robot --name MyRobot --architecture ARMHF --greengrass-group-id 0f728a3c-7dbf-4a3e-976d-d16a8360caba --tags Region=East

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398", "name": "MyRobot", "createdAt": 1550772325.0, "greengrassGroupId": "0f728a3c-7dbf-4a3e-976d-d16a8360caba", "architecture": "ARMHF", "tags": { "Region": "East" } }
  • 如需API詳細資訊,請參閱 命令參考 CreateRobot中的 。 AWS CLI

下列程式碼範例示範如何使用 create-simulation-application-version

AWS CLI

建立模擬應用程式版本

此範例會建立機器人應用程式版本。

命令:

aws robomaker create-simulation-application-version --application arn:aws:robomaker:us-west-2:111111111111:robot-application/MySimulationApplication/1551203427605

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MyRobotApplication/1551203427605", "name": "MyRobotApplication", "version": "1", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-simulation-application.tar.gz", "etag": "00d8a94ff113856688c4fce618ae0f45-94", "architecture": "X86_64" } ], "simulationSoftwareSuite": { "name": "Gazebo", "version": "7" }, "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "renderingEngine": { "name": "OGRE", "version": "1.x" }, "lastUpdatedAt": 1551203853.0, "revisionId": "ee753e53-519c-4d37-895d-65e79bcd1914", "tags": {} }

下列程式碼範例示範如何使用 create-simulation-application

AWS CLI

建立模擬應用程式

此範例會建立模擬應用程式。

命令:

aws robomaker create-simulation-application --name MyRobotApplication --sources s3Bucket=my-bucket,s3Key=my-simulation-application.tar.gz,architecture=ARMHF --robot-software-suite name=ROS,version=Kinetic --simulation-software-suite name=Gazebo,version=7 --rendering-engine name=OGRE,version=1.x

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MyRobotApplication/1551203301792", "name": "MyRobotApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-simulation-application.tar.gz", "architecture": "X86_64" } ], "simulationSoftwareSuite": { "name": "Gazebo", "version": "7" }, "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "renderingEngine": { "name": "OGRE", "version": "1.x" }, "lastUpdatedAt": 1551203301.0, "revisionId": "ee753e53-519c-4d37-895d-65e79bcd1914", "tags": {} }

下列程式碼範例示範如何使用 create-simulation-job

AWS CLI

建立模擬任務

此範例會建立模擬任務。它使用機器人應用程式和模擬應用程式。

命令:

aws robomaker create-simulation-job --max-job-duration-in-seconds 3600 --iam-role arn:aws:iam::111111111111:role/AWSRoboMakerCloudWatch-154766341-SimulationJobRole-G0OBWTQ8YBG6 --robot-applications application=arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821,launchConfig={packageName=hello_world_robot,launchFile=rotate.launch} --simulation-applications application=arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605,launchConfig={packageName=hello_world_simulation,launchFile=empty_world.launch} --tags Region=North

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-w7m68wpr05h8", "status": "Pending", "lastUpdatedAt": 1551213837.0, "failureBehavior": "Fail", "clientRequestToken": "b283ccce-e468-43ee-8642-be76a9d69f15", "maxJobDurationInSeconds": 3600, "simulationTimeMillis": 0, "iamRole": "arn:aws:iam::111111111111:role/MySimulationRole", "robotApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_robot", "launchFile": "rotate.launch" } } ], "simulationApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_simulation", "launchFile": "empty_world.launch" } } ], "tags": { "Region": "North" } }

下列程式碼範例示範如何使用 delete-fleet

AWS CLI

若要刪除機群

此範例會刪除機群。

命令:

aws robomaker delete-fleet --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771394395
  • 如需API詳細資訊,請參閱 命令參考 DeleteFleet中的 。 AWS CLI

下列程式碼範例示範如何使用 delete-robot-application

AWS CLI

若要刪除機器人應用程式

此範例會刪除機器人應用程式。

命令:

aws robomaker delete-robot-application --application arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821

下列程式碼範例示範如何使用 delete-robot

AWS CLI

若要刪除機器人

此範例會刪除機器人。

命令:

aws robomaker delete-robot --robot arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1540829698778
  • 如需API詳細資訊,請參閱 命令參考 DeleteRobot中的 。 AWS CLI

下列程式碼範例示範如何使用 delete-simulation-application

AWS CLI

若要刪除模擬應用程式

此範例會刪除模擬應用程式。

命令:

aws robomaker delete-simulation-application --application arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605

下列程式碼範例示範如何使用 deregister-robot

AWS CLI

從機群取消註冊機器人

此範例會從機群取消註冊機器人。

命令:

aws robomaker deregister-robot --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771358907 --robot arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398

輸出:

{ "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771358907", "robot": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398" }
  • 如需API詳細資訊,請參閱 命令參考 DeregisterRobot中的 。 AWS CLI

下列程式碼範例示範如何使用 describe-deployment-job

AWS CLI

描述部署任務

下列describe-deployment-job範例會擷取指定部署任務的詳細資訊。

aws robomaker describe-deployment-job \ --job arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-xl8qssl6pbcn

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-xl8qssl6pbcn", "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/Trek/1539894765711", "status": "InProgress", "deploymentConfig": { "concurrentDeploymentPercentage": 20, "failureThresholdPercentage": 25 }, "deploymentApplicationConfigs": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/RoboMakerHelloWorldRobot/1546541208251", "applicationVersion": "1", "launchConfig": { "packageName": "hello_world_robot", "launchFile": "rotate.launch" } } ], "createdAt": 1551218369.0, "robotDeploymentSummary": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1540834232469", "deploymentStartTime": 1551218376.0, "status": "Deploying", "progressDetail": {} } ], "tags": {} }

下列程式碼範例示範如何使用 describe-fleet

AWS CLI

描述機群

下列describe-fleet範例會擷取指定機群的詳細資訊。

aws robomaker describe-fleet \ --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771358907

輸出:

{ "name": "MyFleet", "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "robots": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1540834232469", "createdAt": 1540834232.0 }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyOtherRobot/1540829698778", "createdAt": 1540829698.0 } ], "createdAt": 1539894765.0, "lastDeploymentStatus": "Succeeded", "lastDeploymentJob": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-xl8qssl6pbcn", "lastDeploymentTime": 1551218369.0, "tags": {} }
  • 如需API詳細資訊,請參閱 命令參考 DescribeFleet中的 。 AWS CLI

下列程式碼範例示範如何使用 describe-robot-application

AWS CLI

描述機器人應用程式

此範例說明機器人應用程式。

命令:

aws robomaker describe-robot-application --application arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821", "name": "MyRobotApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-robot-application.tar.gz", "architecture": "X86_64" } ], "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "revisionId": "e72efe0d-f44f-4333-b604-f6fa5c6bb50b", "lastUpdatedAt": 1551203485.0, "tags": {} }

下列程式碼範例示範如何使用 describe-robot

AWS CLI

描述機器人

此範例說明機器人。

命令:

aws robomaker describe-robot --robot arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398", "name": "MyRobot", "status": "Available", "greengrassGroupId": "0f728a3c-7dbf-4a3e-976d-d16a8360caba", "createdAt": 1550772325.0, "architecture": "ARMHF", "tags": { "Region": "East" } }
  • 如需API詳細資訊,請參閱 命令參考 DescribeRobot中的 。 AWS CLI

下列程式碼範例示範如何使用 describe-simulation-application

AWS CLI

描述模擬應用程式

此範例說明模擬應用程式。

命令:

aws robomaker describe-simulation-application --application arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605", "name": "MySimulationApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-simulation-application.tar.gz", "architecture": "X86_64" } ], "simulationSoftwareSuite": { "name": "Gazebo", "version": "7" }, "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "renderingEngine": { "name": "OGRE", "version": "1.x" }, "revisionId": "783674ab-b7b8-42d9-b01f-9373907987e5", "lastUpdatedAt": 1551203427.0, "tags": {} }

下列程式碼範例示範如何使用 describe-simulation-job

AWS CLI

描述模擬任務

此範例說明模擬任務。

命令:

aws robomaker describe-simulation-job --job arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-pql32v7pfjy6

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-pql32v7pfjy6", "status": "Running", "lastUpdatedAt": 1551219349.0, "failureBehavior": "Continue", "clientRequestToken": "a19ec4b5-e50d-3591-33da-c2e593c60615", "outputLocation": { "s3Bucket": "my-output-bucket", "s3Prefix": "output" }, "maxJobDurationInSeconds": 3600, "simulationTimeMillis": 0, "iamRole": "arn:aws:iam::111111111111:role/MySimulationRole", "robotApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551206341136", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_robot", "launchFile": "rotate.launch" } } ], "simulationApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551206347967", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_simulation", "launchFile": "empty_world.launch" } } ], "tags": {} }

下列程式碼範例示範如何使用 list-deployment-jobs

AWS CLI

若要列出部署任務

下列list-deployment-jobs範例會擷取部署任務的清單。

aws robomaker list-deployment-jobs

輸出:

{ "deploymentJobs": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/sim-6293szzm56rv", "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "status": "InProgress", "deploymentApplicationConfigs": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/HelloWorldRobot/1546537110575", "applicationVersion": "1", "launchConfig": { "packageName": "hello_world_robot", "launchFile": "rotate.launch", "environmentVariables": { "ENVIRONMENT": "Desert" } } } ], "deploymentConfig": { "concurrentDeploymentPercentage": 20, "failureThresholdPercentage": 25 }, "createdAt": 1550689373.0 }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-4w4g69p25zdb", "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "status": "Pending", "deploymentApplicationConfigs": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/AWSRoboMakerHelloWorld-1544562726923_YGHM_sh5M/1544562822877", "applicationVersion": "1", "launchConfig": { "packageName": "fail", "launchFile": "fail" } } ], "deploymentConfig": { "concurrentDeploymentPercentage": 20, "failureThresholdPercentage": 25 }, "failureReason": "", "failureCode": "", "createdAt": 1544719763.0 } ] }

下列程式碼範例示範如何使用 list-fleets

AWS CLI

列出機群

此範例會列出機群。最多可傳回 20 個機群。

命令:

aws robomaker list-fleets --max-items 20

輸出:

{ "fleetDetails": [ { "name": "Trek", "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "createdAt": 1539894765.0, "lastDeploymentStatus": "Failed", "lastDeploymentJob": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-4w4g69p25zdb", "lastDeploymentTime": 1544719763.0 } ] }
  • 如需API詳細資訊,請參閱 命令參考 ListFleets中的 。 AWS CLI

下列程式碼範例示範如何使用 list-robot-applications

AWS CLI

若要列出機器人應用程式

此範例列出機器人應用程式。結果限制為 20 個機器人應用程式。

命令:

aws robomaker list-robot-applications --max-results 20

輸出:

{ "robotApplicationSummaries": [ { "name": "MyRobot", "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobot/1546537110575", "version": "$LATEST", "lastUpdatedAt": 1546540372.0 }, { "name": "AnotherRobot", "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/AnotherRobot/1546541208251", "version": "$LATEST", "lastUpdatedAt": 1546541208.0 }, { "name": "MySuperRobot", "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MySuperRobot/1547663517377", "version": "$LATEST", "lastUpdatedAt": 1547663517.0 } ] }

下列程式碼範例示範如何使用 list-robots

AWS CLI

若要列出機器人

此範例列出機器人。最多傳回 20 個機器人。

命令:

aws robomaker list-robots --max-results 20

輸出:

{ "robots": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/Robot100/1544035373264", "name": "Robot100", "status": "Available", "createdAt": 1544035373.0, "architecture": "X86_64" }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/Robot101/1542146976587", "name": "Robot101", "status": "Available", "createdAt": 1542146976.0, "architecture": "X86_64" }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/Robot102/1540834232469", "name": "Robot102", "fleetArn": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/Trek/1539894765711", "status": "Available", "createdAt": 1540834232.0, "architecture": "X86_64", "lastDeploymentJob": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-jb007b75gl5f", "lastDeploymentTime": 1550689533.0 }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1540829698778", "name": "MyRobot", "status": "Registered", "createdAt": 1540829698.0, "architecture": "X86_64" } ] }
  • 如需API詳細資訊,請參閱 命令參考 ListRobots中的 。 AWS CLI

下列程式碼範例示範如何使用 list-simulation-applications

AWS CLI

列出模擬應用程式

此範例列出模擬應用程式。最多可傳回 20 個模擬應用程式。

命令:

aws robomaker list-simulation-applications --max-results 20

輸出:

{ "simulationApplicationSummaries": [ { "name": "AWSRoboMakerObjectTracker-1548959046124_NPvyfcatq", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/AWSRoboMakerObjectTracker-1548959046124_NPvyfcatq/1548959170096", "version": "$LATEST", "lastUpdatedAt": 1548959170.0 }, { "name": "RoboMakerHelloWorldSimulation", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/RoboMakerHelloWorldSimulation/1546541198985", "version": "$LATEST", "lastUpdatedAt": 1546541198.0 }, { "name": "RoboMakerObjectTrackerSimulation", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/RoboMakerObjectTrackerSimulation/1545846795615", "version": "$LATEST", "lastUpdatedAt": 1545847405.0 }, { "name": "RoboMakerVoiceInteractionSimulation", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/RoboMakerVoiceInteractionSimulation/1546537100507", "version": "$LATEST", "lastUpdatedAt": 1546540352.0 }, { "name": "AWSRoboMakerCloudWatch-1547663411642_0LIt6D1h6", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/AWSRoboMakerCloudWatch-1547663411642_0LIt6D1h6/1547663521470", "version": "$LATEST", "lastUpdatedAt": 1547663521.0 }, { "name": "AWSRoboMakerDeepRacer-1545848257672_1YZCaieQ-", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/AWSRoboMakerDeepRacer-1545848257672_1YZCaieQ-/1545848370525", "version": "$LATEST", "lastUpdatedAt": 1545848370.0 } ] }

下列程式碼範例示範如何使用 list-simulation-jobs

AWS CLI

若要列出模擬任務

此範例列出模擬任務。

命令:

aws robomaker list-simulation-jobs

輸出:

{ "simulationJobSummaries": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-66bbb3gpxm8x", "lastUpdatedAt": 1548959178.0, "status": "Completed", "simulationApplicationNames": [ "AWSRoboMakerObjectTracker-1548959046124_NPvyfcatq" ], "robotApplicationNames": [ null ] }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-b27c4rkrtzcw", "lastUpdatedAt": 1543514088.0, "status": "Canceled", "simulationApplicationNames": [ "AWSRoboMakerPersonDetection-1543513948280_T8rHW2_lu" ], "robotApplicationNames": [ "AWSRoboMakerPersonDetection-1543513948280_EYaMT0mYb" ] }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-51vxjbzy4q8t", "lastUpdatedAt": 1543508858.0, "status": "Canceled", "simulationApplicationNames": [ "AWSRoboMakerCloudWatch-1543504747391_lFF9ZQyx6" ], "robotApplicationNames": [ "AWSRoboMakerCloudWatch-1543504747391_axbYa3S3K" ] }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-kgf1fqxflqbx", "lastUpdatedAt": 1543504862.0, "status": "Completed", "simulationApplicationNames": [ "AWSRoboMakerCloudWatch-1543504747391_lFF9ZQyx6" ], "robotApplicationNames": [ "AWSRoboMakerCloudWatch-1543504747391_axbYa3S3K" ] }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-vw8lvh061nqt", "lastUpdatedAt": 1543441430.0, "status": "Completed", "simulationApplicationNames": [ "AWSRoboMakerHelloWorld-1543437372341__yb_Jg96l" ], "robotApplicationNames": [ "AWSRoboMakerHelloWorld-1543437372341_lNbmKHvs9" ] }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-txy5ypxmhz84", "lastUpdatedAt": 1543437488.0, "status": "Completed", "simulationApplicationNames": [ "AWSRoboMakerHelloWorld-1543437372341__yb_Jg96l" ], "robotApplicationNames": [ "AWSRoboMakerHelloWorld-1543437372341_lNbmKHvs9" ] } ] }

下列程式碼範例示範如何使用 list-tags-for-resource

AWS CLI

列出資源的標籤

此範例會列出 AWS RoboMaker 資源的標籤。

命令:

aws robomaker list-tags-for-resource --resource-arn "arn:aws:robomaker:us-west-2:111111111111:robot/Robby_the_Robot/1544035373264"

輸出:

{ "tags": { "Region": "North", "Stage": "Initial" } }

下列程式碼範例示範如何使用 register-robot

AWS CLI

註冊機器人

此範例會將機器人註冊到機群。

命令:

aws robomaker register-robot --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771358907 --robot arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398

輸出:

{ "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771358907", "robot": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398" }
  • 如需API詳細資訊,請參閱 命令參考 RegisterRobot中的 。 AWS CLI

下列程式碼範例示範如何使用 restart-simulation-job

AWS CLI

重新啟動模擬

此範例會重新啟動模擬。

命令:

aws robomaker restart-simulation-job --job arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-t6rdgt70mftr

下列程式碼範例示範如何使用 sync-deployment-job

AWS CLI

若要同步部署任務

此範例會同步部署任務。

命令:

aws robomaker sync-deployment-job --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/Trek/1539894765711

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-09ccxs3tlfms", "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "status": "Pending", "deploymentConfig": { "concurrentDeploymentPercentage": 20, "failureThresholdPercentage": 25 }, "deploymentApplicationConfigs": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1546541208251", "applicationVersion": "1", "launchConfig": { "packageName": "hello_world_simulation", "launchFile": "empty_world.launch" } } ], "createdAt": 1551286954.0 }

下列程式碼範例示範如何使用 tag-resource

AWS CLI

標記資源

此範例會標記資源。它連接兩個標籤:區域和階段。

命令:

aws robomaker tag-resource --resource-arn "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1544035373264" --tags Region=North,Stage=Initial
  • 如需API詳細資訊,請參閱 命令參考 TagResource中的 。 AWS CLI

下列程式碼範例示範如何使用 untag-resource

AWS CLI

若要取消標記資源

此範例會從資源移除標籤。它會移除區域標籤。

命令:

aws robomaker untag-resource --resource-arn "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1544035373264" --tag-keys Region
  • 如需API詳細資訊,請參閱 命令參考 UntagResource中的 。 AWS CLI

下列程式碼範例示範如何使用 update-robot-application

AWS CLI

更新機器人應用程式

此範例會更新機器人應用程式。

命令:

aws robomaker update-robot-application --application arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821 --sources s3Bucket=my-bucket,s3Key=my-robot-application.tar.gz,architecture=X86_64 --robot-software-suite name=ROS,version=Kinetic

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821", "name": "MyRobotApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-robot-application.tar.gz", "architecture": "X86_64" } ], "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "lastUpdatedAt": 1551287993.0, "revisionId": "20b5e331-24fd-4504-8b8c-531afe5f4c94" }

下列程式碼範例示範如何使用 update-simulation-application

AWS CLI

更新模擬應用程式

此範例會更新模擬應用程式。

命令:

aws robomaker update-simulation-application --application arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605 --sources s3Bucket=my-bucket,s3Key=my-simulation-application.tar.gz,architecture=X86_64 --robot-software-suite name=ROS,version=Kinetic --simulation-software-suite name=Gazebo,version=7 --rendering-engine name=OGRE,version=1.x

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605", "name": "MySimulationApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-simulation-application.tar.gz", "architecture": "X86_64" } ], "simulationSoftwareSuite": { "name": "Gazebo", "version": "7" }, "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "renderingEngine": { "name": "OGRE", "version": "1.x" }, "lastUpdatedAt": 1551289361.0, "revisionId": "4a22cb5d-93c5-4cef-9311-52bdd119b79e" }