Updating assets and models - AWS IoT SiteWise

Updating assets and models

You can update your assets and asset models in AWS IoT SiteWise to modify their names and definitions. These update operations are asynchronous and take time to propagate through AWS IoT SiteWise. Check the status of the asset or asset model before you make additional changes. You must wait until the changes propagate before you can continue to use the updated asset or model.

Updating assets

You can use the AWS IoT SiteWise console or API to update an asset's name.

When you update an asset, the asset's status is UPDATING until the changes propagate. For more information, see Asset and model states.

Updating an asset (console)

You can use the AWS IoT SiteWise console to update asset details.

To update an asset (console)

  1. Navigate to the AWS IoT SiteWise console.

  2. In the navigation pane, choose Assets.

  3. Choose the asset to update.

    Tip

    You can choose the arrow icon to expand an asset hierarchy to find your asset.

    
        AWS IoT SiteWise "Assets" page screenshot with an asset hierarchy
          highlighted.
  4. Choose Edit.

  5. Update the asset's Name.

  6. (Optional) On this page, update other information for the asset. For more information, see the following:

  7. Choose Save.

Updating an asset (CLI)

You can use the AWS CLI to update an asset's name.

Use the UpdateAsset operation to update an asset. Specify the following parameters:

  • assetId – The asset's ID.

  • assetName – The asset's new name.

To update an asset's name (CLI)

  • Run the following command to update an asset's name. Replace asset-id with the ID of the asset and asset-name with the new name for the asset.

    aws iotsitewise update-asset \ --asset-id asset-id \ --asset-name asset-name

Updating asset models

You can use the AWS IoT SiteWise console or API to update an asset model.

You can't change the type or data type of an existing property. You also can't change the window of an existing metric.

Important

If you remove a property from an asset model, AWS IoT SiteWise deletes all previous data for that property. If you remove a hierarchy definition from an asset model, AWS IoT SiteWise disassociates all assets in that hierarchy.

When you update an asset model, every asset based on that model reflects any changes that you make to the underlying model. Until the changes propagate, each asset has the UPDATING state. You must wait until those assets return to the ACTIVE state before you interact with them. During this time, the updated asset model's status will be PROPAGATING. For more information, see Asset and model states.

Updating an asset model (console)

You can use the AWS IoT SiteWise console to update an asset model.

To update an asset model (console)

  1. Navigate to the AWS IoT SiteWise console.

  2. In the navigation pane, choose Models.

  3. Choose the asset model to update.

  4. Choose Edit.

  5. On the Edit model page, do any of the following:

  6. Choose Save.

Updating an asset model (CLI)

You can use the AWS CLI to update an asset model.

Use the UpdateAssetModel operation to update an asset model's name, description, properties, and hierarchies. Specify the following parameter:

  • assetModelId – The asset model's ID.

Specify the updated asset model in the payload. To learn about the expected format of an asset model, see Creating asset models.

Warning

The UpdateAssetModel operation overwrites the existing model with the model that you provide in the payload. To avoid deleting your asset model's properties or hierarchies, you must include their IDs and definitions in the updated asset model payload. To learn how to query your model's existing structure, see the DescribeAssetModel operation.

To update an asset model (CLI)

  1. Run the following command to retrieve the existing asset model definition. Replace asset-model-id with the ID of the asset model to update.

    aws iotsitewise describe-asset-model --asset-model-id asset-model-id

    The operation returns a response that contains the asset model's details. The response has the following structure.

    { "assetModelId": "String", "assetModelArn": "String", "assetModelName": "String", "assetModelDescription": "String", "assetModelProperties": Array of AssetModelProperty, "assetModelHierarchies": Array of AssetModelHierarchyDefinition, "assetModelCreationDate": "String", "assetModelLastUpdateDate": "String", "assetModelStatus": { "state": "String", "error": { "code": "String", "message": "String" } } }

    For more information, see the DescribeAssetModel operation.

  2. Create a file called update-asset-model.json and copy the previous command's response into the file.

  3. Remove the following key-value pairs from the JSON object in update-asset-model.json:

    • assetModelId

    • assetModelArn

    • assetModelCreationDate

    • assetModelLastUpdateDate

    • assetModelStatus

    The UpdateAssetModel operation expects a payload with the following structure.

    { "assetModelName": "String", "assetModelDescription": "String", "assetModelProperties": Array of AssetModelProperty, "assetModelHierarchies": Array of AssetModelHierarchyDefinition }
  4. In update-asset-model.json, do any of the following:

    • Change the asset model's name (assetModelName).

    • Change, add, or remove the asset model's description (assetModelDescription).

    • Change, add, or remove any of the asset model's properties (assetModelProperties). You can't change the dataType of existing properties or the window of existing metrics. For more information, see Defining data properties.

    • Change, add, or remove any of the asset model's hierarchies (assetModelHierarchies). You can't change the childAssetModelId of existing hierarchies. For more information, see Defining relationships between assets (hierarchies).

  5. Run the following command to update the asset model with the definition stored in update-asset-model.json. Replace asset-model-id with the ID of the asset model.

    aws iotsitewise update-asset-model \ --asset-model-id asset-model-id \ --cli-input-json file://model-payload.json