Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

Note: You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . iotsitewise ]

create-asset-model

Description

Creates an asset model from specified property and hierarchy definitions. You create assets from asset models. With asset models, you can easily create assets of the same type that have standardized definitions. Each asset created from a model inherits the asset model's property and hierarchy definitions. For more information, see Defining Asset Models in the AWS IoT SiteWise User Guide .

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  create-asset-model
--asset-model-name <value>
[--asset-model-description <value>]
[--asset-model-properties <value>]
[--asset-model-hierarchies <value>]
[--client-token <value>]
[--tags <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--asset-model-name (string)

A unique, friendly name for the asset model.

--asset-model-description (string)

A description for the asset model.

--asset-model-properties (list)

The property definitions of the asset model. For more information, see Asset Properties in the AWS IoT SiteWise User Guide .

You can specify up to 200 properties per asset model. For more information, see Quotas in the AWS IoT SiteWise User Guide .

JSON Syntax:

[
  {
    "name": "string",
    "dataType": "STRING"|"INTEGER"|"DOUBLE"|"BOOLEAN",
    "unit": "string",
    "type": {
      "attribute": {
        "defaultValue": "string"
      },
      "measurement": {

      },
      "transform": {
        "expression": "string",
        "variables": [
          {
            "name": "string",
            "value": {
              "propertyId": "string",
              "hierarchyId": "string"
            }
          }
          ...
        ]
      },
      "metric": {
        "expression": "string",
        "variables": [
          {
            "name": "string",
            "value": {
              "propertyId": "string",
              "hierarchyId": "string"
            }
          }
          ...
        ],
        "window": {
          "tumbling": {
            "interval": "string"
          }
        }
      }
    }
  }
  ...
]

--asset-model-hierarchies (list)

The hierarchy definitions of the asset model. Each hierarchy specifies an asset model whose assets can be children of any other assets created from this asset model. For more information, see Asset Hierarchies in the AWS IoT SiteWise User Guide .

You can specify up to 10 hierarchies per asset model. For more information, see Quotas in the AWS IoT SiteWise User Guide .

Shorthand Syntax:

name=string,childAssetModelId=string ...

JSON Syntax:

[
  {
    "name": "string",
    "childAssetModelId": "string"
  }
  ...
]

--client-token (string)

A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.

--tags (map)

A list of key-value pairs that contain metadata for the asset model. For more information, see Tagging your AWS IoT SiteWise resources in the AWS IoT SiteWise User Guide .

Shorthand Syntax:

KeyName1=string,KeyName2=string

JSON Syntax:

{"string": "string"
  ...}

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

To create an asset model

The following create-asset-model example creates an asset model that defines a wind turbine with the following properties:

  • Serial number - The serial number of a wind turbine
  • Generated power - The generated power data stream from a wind turbine
  • Temperature C - The temperature data stream from a wind turbine in Celsius
  • Temperature F - The mapped temperature data points from Celsius to Fahrenheit
aws iotsitewise create-asset-model \
    --cli-input-json file://create-wind-turbine-model.json

Contents of create-wind-turbine-model.json:

{
    "assetModelName": "Wind Turbine Model",
    "assetModelDescription": "Represents a wind turbine",
    "assetModelProperties": [
        {
            "name": "Serial Number",
            "dataType": "STRING",
            "type": {
                "attribute": {}
            }
        },
        {
            "name": "Generated Power",
            "dataType": "DOUBLE",
            "unit": "kW",
            "type": {
                "measurement": {}
            }
        },
        {
            "name": "Temperature C",
            "dataType": "DOUBLE",
            "unit": "Celsius",
            "type": {
                "measurement": {}
            }
        },
        {
            "name": "Temperature F",
            "dataType": "DOUBLE",
            "unit": "Fahrenheit",
            "type": {
                "transform": {
                    "expression": "temp_c * 9 / 5 + 32",
                    "variables": [
                        {
                            "name": "temp_c",
                            "value": {
                                "propertyId": "Temperature C"
                            }
                        }
                    ]
                }
            }
        },
        {
            "name": "Total Generated Power",
            "dataType": "DOUBLE",
            "unit": "kW",
            "type": {
                "metric": {
                    "expression": "sum(power)",
                    "variables": [
                        {
                            "name": "power",
                            "value": {
                                "propertyId": "Generated Power"
                            }
                        }
                    ],
                    "window": {
                        "tumbling": {
                            "interval": "1h"
                        }
                    }
                }
            }
        }
    ]
}

Output:

{
    "assetModelId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
    "assetModelArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
    "assetModelStatus": {
        "state": "CREATING"
    }
}

For more information, see Defining asset models in the AWS IoT SiteWise User Guide.

Output

assetModelId -> (string)

The ID of the asset model. You can use this ID when you call other AWS IoT SiteWise APIs.

assetModelArn -> (string)

The ARN of the asset model, which has the following format.

arn:${Partition}:iotsitewise:${Region}:${Account}:asset-model/${AssetModelId}

assetModelStatus -> (structure)

The status of the asset model, which contains a state (CREATING after successfully calling this operation) and any error message.

state -> (string)

The current state of the asset model.

error -> (structure)

Contains associated error information, if any.

code -> (string)

The error code.

message -> (string)

The error message.