Create a vehicle (AWS CLI) - AWS IoT FleetWise

Create a vehicle (AWS CLI)

When you create a vehicle, you must use a vehicle model that is associated with a decoder manifest. You can use the CreateVehicle API operation to create a vehicle. The following example uses the AWS CLI.

Important

Before you start, check the following:

To create a vehicle, run the following command.

Replace file-name with the name of the JSON file that contains the vehicle configuration.

aws iotfleetwise create-vehicle --cli-input-json file://file-name.json
Example vehicle configuration
  • (Optional) The associationBehavior value can be one of the following:

    • CreateIotThing – When your vehicle is created, AWS IoT FleetWise automatically creates an AWS IoT thing with the name of your vehicle ID for your vehicle.

    • ValidateIotThingExists – Use an existing AWS IoT thing to create a vehicle.

      To create an AWS IoT thing, run the following command. Replace thing-name with the name of the thing you want to create.

      aws iot create-thing --thing-name thing-name

    If it's not specified, AWS IoT FleetWise automatically creates an AWS IoT thing for your vehicle.

    Important

    Make sure that the AWS IoT thing is provisioned after the vehicle is created. For more information, see Provision vehicles.

  • Replace vehicle-name with one of the following.

    • The name of your AWS IoT thing if associationBehavior is configured to ValidateIotThingExists.

    • The ID of the vehicle to create if associationBehavior is configured to CreateIotThing.

      The vehicle ID can have 1–100 characters. Valid characters: a–z, A–Z, 0–9, dash (‐), underscore (_), and colon (:).

  • Replace model-manifest-ARN with the ARN of your vehicle model (model manifest).

  • Replace decoder-manifest-ARN with the ARN of the decoder manifest associated with the specified vehicle model.

  • (Optional) You can add additional attributes to distinguish this vehicle from other vehicles created from the same vehicle model. For example, if you have an electric car, you can specify the following value for an attribute: {"fuelType": "electric"}.

    Important

    Attributes must be defined in the associated vehicle model before you can add them to individual vehicles.

{ "associationBehavior": "associationBehavior", "vehicleName": "vehicle-name", "modelManifestArn": "model-manifest-ARN", "decoderManifestArn": "decoder-manifest-ARN", "attributes": { "key": "value" } }