Updating custom composite models (Components) - AWS IoT SiteWise

Updating custom composite models (Components)

You can use the AWS IoT SiteWise API to update a custom composite model, or the AWS IoT SiteWise console to update components.

Updating a component (console)

You can use the AWS IoT SiteWise console to update a component.

To update a component (console)
  1. Navigate to the AWS IoT SiteWise console.

  2. In the navigation pane, choose Models.

  3. Choose the asset model where the component is.

  4. On the Properties tab, choose Components.

  5. Choose the component that you want to update.

  6. Choose Edit.

  7. On the Edit component page, do any of the following:

  8. Choose Save.

Updating a custom composite model (AWS CLI)

You can use the AWS Command Line Interface (AWS CLI) to update a custom composite model.

To update the name or description, use the UpdateAssetModelCompositeModel operation. For inline custom composite models only, you can also update the properties. You can't update the properties of a component-model-based custom composite model, because its referenced component model provides its associated properties.

Important

If you remove a property from a custom composite model, AWS IoT SiteWise deletes all previous data for that property. You can’t change the type or data type of an existing property.

To replace an existing composite model property with a new one with the same name, do the following:

  1. Submit an UpdateAssetModelCompositeModel request with the entire existing property removed.

  2. Submit a second UpdateAssetModelCompositeModel request that includes the new property. The new asset property will have the same name as the previous one and AWS IoT SiteWise will generate a new unique id.

To update a custom composite model (AWS CLI)
  1. To retrieve the existing composite model definition, run the following command. Replace composite-model-id with the ID or the external ID of the custom composite model to update, and asset-model-id with the asset model that the custom composite model is associated with. For more information, see in the AWS IoT SiteWise User Guide.

    aws iotsitewise describe-asset-model-composite-model \ --asset-model-composite-model-id composite-model-id \ --asset-model-id asset-model-id

    For more information, see the DescribeAssetModelCompositeModel operation.

  2. Create a file called update-custom-composite-model.json, and then copy the previous command's response into the file.

  3. Remove every key-value pair from the JSON object in update-custom-composite-model.json except for the following fields:

    • assetModelCompositeModelName

    • assetModelCompositeModelDescription (if present)

    • assetModelCompositeModelProperties (if present)

  4. In update-custom-composite-model.json, do any of the following:

    • Change the value of assetModelCompositeModelName.

    • Add or remove assetModelCompositeModelDescription, or change its value.

    • For inline custom composite models only: Change, add, or remove any of the asset model's properties in assetModelCompositeModelProperties.

    For more information about the required format for this file, see the request syntax for UpdateAssetModelCompositeModel.

  5. Run the following command to update the custom composite model with the definition stored in update-custom-composite-model.json. Replace composite-model-id with the ID of the composite model, and asset-model-id with the ID of the asset model it's in.

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