This documentation is for Version 1 of the Amazon CLI only. For documentation related to Version 2 of the Amazon CLI, see the Version 2 User Guide.
Amazon IoT SiteWise examples using Amazon CLI
The following code examples show you how to perform actions and implement common scenarios by using the Amazon Command Line Interface with Amazon IoT SiteWise.
Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.
Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.
Topics
Actions
The following code example shows how to use associate-assets
.
- Amazon CLI
-
To associate a child asset to a parent asset
The following
associate-assets
example associates a wind turbine asset to a wind farm asset, where the wind turbine asset model exists as a hierarchy in the wind farm asset model.aws iotsitewise associate-assets \ --asset-id
a1b2c3d4-5678-90ab-cdef-44444EXAMPLE
\ --hierarchy-ida1b2c3d4-5678-90ab-cdef-77777EXAMPLE
\ --child-asset-ida1b2c3d4-5678-90ab-cdef-33333EXAMPLE
This command produces no output.
For more information, see Associating assets
in the Amazon IoT SiteWise User Guide. -
For API details, see AssociateAssets
in Amazon CLI Command Reference.
-
The following code example shows how to use batch-associate-project-assets
.
- Amazon CLI
-
To associate an asset to a project
The following
batch-associate-project-assets
example associates a wind farm asset to a project.aws iotsitewise batch-associate-project-assets \ --project-id
a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
\ --asset-idsa1b2c3d4-5678-90ab-cdef-44444EXAMPLE
This command produces no output.
For more information, see Adding assets to projects
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see BatchAssociateProjectAssets
in Amazon CLI Command Reference.
-
The following code example shows how to use batch-disassociate-project-assets
.
- Amazon CLI
-
To disassociate an asset from a project
The following
batch-disassociate-project-assets
example disassociates a wind farm asset from a project.aws iotsitewise batch-disassociate-project-assets \ --project-id
a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
\ --asset-idsa1b2c3d4-5678-90ab-cdef-44444EXAMPLE
This command produces no output.
For more information, see Adding assets to projects
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see BatchDisassociateProjectAssets
in Amazon CLI Command Reference.
-
The following code example shows how to use batch-put-asset-property-value
.
- Amazon CLI
-
To send data to asset properties
The following
batch-put-asset-property-value
example sends power and temperature data to the asset properties identified by property aliases.aws iotsitewise batch-put-asset-property-value \ --cli-input-json
file://batch-put-asset-property-value.json
Contents of
batch-put-asset-property-value.json
:{ "entries": [ { "entryId": "1575691200-company-windfarm-3-turbine-7-power", "propertyAlias": "company-windfarm-3-turbine-7-power", "propertyValues": [ { "value": { "doubleValue": 4.92 }, "timestamp": { "timeInSeconds": 1575691200 }, "quality": "GOOD" } ] }, { "entryId": "1575691200-company-windfarm-3-turbine-7-temperature", "propertyAlias": "company-windfarm-3-turbine-7-temperature", "propertyValues": [ { "value": { "integerValue": 38 }, "timestamp": { "timeInSeconds": 1575691200 } } ] } ] }
Output:
{ "errorEntries": [] }
For more information, see Ingesting data using the Amazon IoT SiteWise API
in the Amazon IoT SiteWise User Guide. -
For API details, see BatchPutAssetPropertyValue
in Amazon CLI Command Reference.
-
The following code example shows how to use create-access-policy
.
- Amazon CLI
-
Example 1: To grant a user administrative access to a portal
The following
create-access-policy
example creates an access policy that grants a user administrative access to a web portal for a wind farm company.aws iotsitewise create-access-policy \ --cli-input-json
file://create-portal-administrator-access-policy.json
Contents of
create-portal-administrator-access-policy.json
:{ "accessPolicyIdentity": { "user": { "id": "a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE" } }, "accessPolicyPermission": "ADMINISTRATOR", "accessPolicyResource": { "portal": { "id": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE" } } }
Output:
{ "accessPolicyId": "a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE", "accessPolicyArn": "arn:aws:iotsitewise:us-west-2:123456789012:access-policy/a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE" }
For more information, see Adding or removing portal administrators
in the Amazon IoT SiteWise User Guide. Example 2: To grant a user read-only access to a project
The following
create-access-policy
example creates an access policy that grants a user read-only access to a wind farm project.aws iotsitewise create-access-policy \ --cli-input-json
file://create-project-viewer-access-policy.json
Contents of
create-project-viewer-access-policy.json
:{ "accessPolicyIdentity": { "user": { "id": "a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE" } }, "accessPolicyPermission": "VIEWER", "accessPolicyResource": { "project": { "id": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE" } } }
Output:
{ "accessPolicyId": "a1b2c3d4-5678-90ab-cdef-dddddEXAMPLE", "accessPolicyArn": "arn:aws:iotsitewise:us-west-2:123456789012:access-policy/a1b2c3d4-5678-90ab-cdef-dddddEXAMPLE" }
For more information, see Assigning project viewers
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see CreateAccessPolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use create-asset-model
.
- Amazon CLI
-
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 turbineGenerated power - The generated power data stream from a wind turbineTemperature C - The temperature data stream from a wind turbine in CelsiusTemperature 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 Amazon IoT SiteWise User Guide. -
For API details, see CreateAssetModel
in Amazon CLI Command Reference.
-
The following code example shows how to use create-asset
.
- Amazon CLI
-
To create an asset
The following
create-asset
example creates a wind turbine asset from a wind turbine asset model.aws iotsitewise create-asset \ --asset-model-id
a1b2c3d4-5678-90ab-cdef-11111EXAMPLE
\ --asset-name"Wind Turbine 1"
Output:
{ "assetId": "a1b2c3d4-5678-90ab-cdef-33333EXAMPLE", "assetArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE", "assetStatus": { "state": "CREATING" } }
For more information, see Creating assets
in the Amazon IoT SiteWise User Guide. -
For API details, see CreateAsset
in Amazon CLI Command Reference.
-
The following code example shows how to use create-dashboard
.
- Amazon CLI
-
To create a dashboard
The following
create-dashboard
example creates a dashboard with a line chart that displays total generated power for a wind farm.aws iotsitewise create-dashboard \ --project-id
a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
\ --dashboard-name"Wind Farm"
\ --dashboard-definitionfile://create-wind-farm-dashboard.json
Contents of
create-wind-farm-dashboard.json
:{ "widgets": [ { "type": "monitor-line-chart", "title": "Generated Power", "x": 0, "y": 0, "height": 3, "width": 3, "metrics": [ { "label": "Power", "type": "iotsitewise", "assetId": "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE", "propertyId": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE" } ] } ] }
Output:
{ "dashboardId": "a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE", "dashboardArn": "arn:aws:iotsitewise:us-west-2:123456789012:dashboard/a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE" }
For more information, see Creating dashboards (CLI)
in the Amazon IoT SiteWise User Guide. -
For API details, see CreateDashboard
in Amazon CLI Command Reference.
-
The following code example shows how to use create-gateway
.
- Amazon CLI
-
To create a gateway
The following
create-gateway
example creates a gateway that runs on Amazon IoT Greengrass.aws iotsitewise create-gateway \ --gateway-name
ExampleCorpGateway
\ --gateway-platformgreengrass={groupArn=arn:aws:greengrass:us-west-2:123456789012:/greengrass/groups/a1b2c3d4-5678-90ab-cdef-1b1b1EXAMPLE}
Output:
{ "gatewayId": "a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE", "gatewayArn": "arn:aws:iotsitewise:us-west-2:123456789012:gateway/a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE" }
For more information, see Configuring a gateway
in the Amazon IoT SiteWise User Guide. -
For API details, see CreateGateway
in Amazon CLI Command Reference.
-
The following code example shows how to use create-portal
.
- Amazon CLI
-
To create a portal
The following
create-portal
example creates a web portal for a wind farm company. You can create portals only in the same Region where you enabled Amazon Single Sign-On.aws iotsitewise create-portal \ --portal-name
WindFarmPortal
\ --portal-description"A portal that contains wind farm projects for Example Corp."
\ --portal-contact-emailsupport@example.com
\ --role-arnarn:aws:iam::123456789012:role/service-role/MySiteWiseMonitorServiceRole
Output:
{ "portalId": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE", "portalArn": "arn:aws:iotsitewise:us-west-2:123456789012:portal/a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE", "portalStartUrl": "https://a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE.app.iotsitewise.aws", "portalStatus": { "state": "CREATING" }, "ssoApplicationId": "ins-a1b2c3d4-EXAMPLE" }
For more information, see Getting started with Amazon IoT SiteWise Monitor
in the Amazon IoT SiteWise User Guide and Enabling Amazon SSO in the Amazon IoT SiteWise User Guide.. -
For API details, see CreatePortal
in Amazon CLI Command Reference.
-
The following code example shows how to use create-project
.
- Amazon CLI
-
To create a project
The following
create-project
example creates a wind farm project.aws iotsitewise create-project \ --portal-id
a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE
\ --project-name"Wind Farm 1"
\ --project-description"Contains asset visualizations for Wind Farm #1 for Example Corp."
Output:
{ "projectId": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE", "projectArn": "arn:aws:iotsitewise:us-west-2:123456789012:project/a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE" }
For more information, see Creating projects
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see CreateProject
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-access-policy
.
- Amazon CLI
-
To revoke a user's access to a project or portal
The following
delete-access-policy
example deletes an access policy that grants a user administrative access to a portal.aws iotsitewise delete-access-policy \ --access-policy-id
a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE
This command produces no output.
For more information, see Adding or removing portal administrators
in the Amazon IoT SiteWise User Guide. -
For API details, see DeleteAccessPolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-asset-model
.
- Amazon CLI
-
To delete an asset model
The following
delete-asset-model
example deletes a wind turbine asset model.aws iotsitewise delete-asset-model \ --asset-model-id
a1b2c3d4-5678-90ab-cdef-11111EXAMPLE
Output:
{ "assetModelStatus": { "state": "DELETING" } }
For more information, see Deleting asset models
in the Amazon IoT SiteWise User Guide. -
For API details, see DeleteAssetModel
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-asset
.
- Amazon CLI
-
To delete an asset
The following
delete-asset
example deletes a wind turbine asset.aws iotsitewise delete-asset \ --asset-id
a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
Output:
{ "assetStatus": { "state": "DELETING" } }
For more information, see Deleting assets
in the Amazon IoT SiteWise User Guide. -
For API details, see DeleteAsset
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-dashboard
.
- Amazon CLI
-
To delete a dashboard
The following
delete-dashboard
example deletes a wind turbine dashboard.aws iotsitewise delete-dashboard \ --dashboard-id
a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE
This command produces no output.
For more information, see Deleting dashboards
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see DeleteDashboard
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-gateway
.
- Amazon CLI
-
To delete a gateway
The following
delete-gateway
example deletes a gateway.aws iotsitewise delete-gateway \ --gateway-id
a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE
This command produces no output.
For more information, see Ingesting data using a gateway
in the Amazon IoT SiteWise User Guide. -
For API details, see DeleteGateway
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-portal
.
- Amazon CLI
-
To delete a portal
The following
delete-portal
example deletes a web portal for a wind farm company.aws iotsitewise delete-portal \ --portal-id
a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE
Output:
{ "portalStatus": { "state": "DELETING" } }
For more information, see Deleting a portal
in the Amazon IoT SiteWise User Guide. -
For API details, see DeletePortal
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-project
.
- Amazon CLI
-
To delete a project
The following
delete-project
example deletes a wind farm project.aws iotsitewise delete-project \ --project-id
a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
This command produces no output.
For more information, see Deleting projects
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see DeleteProject
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-access-policy
.
- Amazon CLI
-
To describe an access policy
The following
describe-access-policy
example describes an access policy that grants a user administrative access to a web portal for a wind farm company.aws iotsitewise describe-access-policy \ --access-policy-id
a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE
Output:
{ "accessPolicyId": "a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE", "accessPolicyArn": "arn:aws:iotsitewise:us-west-2:123456789012:access-policy/a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE", "accessPolicyIdentity": { "user": { "id": "a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE" } }, "accessPolicyResource": { "portal": { "id": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE" } }, "accessPolicyPermission": "ADMINISTRATOR", "accessPolicyCreationDate": "2020-02-20T22:35:15.552880124Z", "accessPolicyLastUpdateDate": "2020-02-20T22:35:15.552880124Z" }
For more information, see Adding or removing portal administrators
in the Amazon IoT SiteWise User Guide. -
For API details, see DescribeAccessPolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-asset-model
.
- Amazon CLI
-
To describe an asset model
The following
describe-asset-model
example describes a wind farm asset model.aws iotsitewise describe-asset-model \ --asset-model-id
a1b2c3d4-5678-90ab-cdef-22222EXAMPLE
Output:
{ "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "assetModelArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "assetModelName": "Wind Farm Model", "assetModelDescription": "Represents a wind farm that comprises many wind turbines", "assetModelProperties": [ { "id": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE", "name": "Total Generated Power", "dataType": "DOUBLE", "unit": "kW", "type": { "metric": { "expression": "sum(power)", "variables": [ { "name": "power", "value": { "propertyId": "a1b2c3d4-5678-90ab-cdef-66666EXAMPLE", "hierarchyId": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE" } } ], "window": { "tumbling": { "interval": "1h" } } } } }, { "id": "a1b2c3d4-5678-90ab-cdef-88888EXAMPLE", "name": "Region", "dataType": "STRING", "type": { "attribute": { "defaultValue": " " } } } ], "assetModelHierarchies": [ { "id": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE", "name": "Wind Turbines", "childAssetModelId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" } ], "assetModelCreationDate": 1575671284.0, "assetModelLastUpdateDate": 1575671988.0, "assetModelStatus": { "state": "ACTIVE" } }
For more information, see Describing a specific asset model
in the Amazon IoT SiteWise User Guide. -
For API details, see DescribeAssetModel
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-asset-property
.
- Amazon CLI
-
To describe an asset property
The following
describe-asset-property
example describes a wind farm asset's total generated power property.aws iotsitewise describe-asset-property \ --asset-id
a1b2c3d4-5678-90ab-cdef-44444EXAMPLE
\ --property-ida1b2c3d4-5678-90ab-cdef-99999EXAMPLE
Output:
{ "assetId": "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE", "assetName": "Wind Farm 1", "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "assetProperty": { "id": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE", "name": "Total Generated Power", "notification": { "topic": "$aws/sitewise/asset-models/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE/assets/a1b2c3d4-5678-90ab-cdef-44444EXAMPLE/properties/a1b2c3d4-5678-90ab-cdef-99999EXAMPLE", "state": "DISABLED" }, "dataType": "DOUBLE", "unit": "kW", "type": { "metric": { "expression": "sum(power)", "variables": [ { "name": "power", "value": { "propertyId": "a1b2c3d4-5678-90ab-cdef-66666EXAMPLE", "hierarchyId": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE" } } ], "window": { "tumbling": { "interval": "1h" } } } } } }
For more information, see Describing a specific asset property
in the Amazon IoT SiteWise User Guide. -
For API details, see DescribeAssetProperty
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-asset
.
- Amazon CLI
-
To describe an asset
The following
describe-asset
example describes a wind farm asset.aws iotsitewise describe-asset \ --asset-id
a1b2c3d4-5678-90ab-cdef-44444EXAMPLE
Output:
{ "assetId": "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE", "assetArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-44444EXAMPLE", "assetName": "Wind Farm 1", "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "assetProperties": [ { "id": "a1b2c3d4-5678-90ab-cdef-88888EXAMPLE", "name": "Region", "dataType": "STRING" }, { "id": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE", "name": "Total Generated Power", "dataType": "DOUBLE", "unit": "kW" } ], "assetHierarchies": [ { "id": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE", "name": "Wind Turbines" } ], "assetCreationDate": 1575672453.0, "assetLastUpdateDate": 1575672453.0, "assetStatus": { "state": "ACTIVE" } }
For more information, see Describing a specific asset
in the Amazon IoT SiteWise User Guide. -
For API details, see DescribeAsset
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-dashboard
.
- Amazon CLI
-
To describe a dashboard
The following
describe-dashboard
example describes the specified wind farm dashboard.aws iotsitewise describe-dashboard \ --dashboard-id
a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE
Output:
{ "dashboardId": "a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE", "dashboardArn": "arn:aws:iotsitewise:us-west-2:123456789012:dashboard/a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE", "dashboardName": "Wind Farm", "projectId": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE", "dashboardDefinition": "{\"widgets\":[{\"type\":\"monitor-line-chart\",\"title\":\"Generated Power\",\"x\":0,\"y\":0,\"height\":3,\"width\":3,\"metrics\":[{\"label\":\"Power\",\"type\":\"iotsitewise\",\"assetId\":\"a1b2c3d4-5678-90ab-cdef-44444EXAMPLE\",\"propertyId\":\"a1b2c3d4-5678-90ab-cdef-99999EXAMPLE\"}]}]}", "dashboardCreationDate": "2020-05-01T20:32:12.228476348Z", "dashboardLastUpdateDate": "2020-05-01T20:32:12.228476348Z" }
For more information, see Viewing dashboards
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see DescribeDashboard
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-gateway-capability-configuration
.
- Amazon CLI
-
To describe a gateway capability
The following
describe-gateway-capability-configuration
example describes an OPC-UA source capability.aws iotsitewise describe-gateway-capability-configuration \ --gateway-id
a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE
\ --capability-namespace"iotsitewise:opcuacollector:1"
Output:
{ "gatewayId": "a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE", "capabilityNamespace": "iotsitewise:opcuacollector:1", "capabilityConfiguration": "{\"sources\":[{\"name\":\"Wind Farm #1\",\"endpoint\":{\"certificateTrust\":{\"type\":\"TrustAny\"},\"endpointUri\":\"opc.tcp://203.0.113.0:49320\",\"securityPolicy\":\"BASIC256\",\"messageSecurityMode\":\"SIGN_AND_ENCRYPT\",\"identityProvider\":{\"type\":\"Username\",\"usernameSecretArn\":\"arn:aws:secretsmanager:us-east-1:123456789012:secret:greengrass-factory1-auth-3QNDmM\"},\"nodeFilterRules\":[]},\"measurementDataStreamPrefix\":\"\"}]}", "capabilitySyncStatus": "IN_SYNC" }
For more information, see Configuring data sources
in the Amazon IoT SiteWise User Guide. -
For API details, see DescribeGatewayCapabilityConfiguration
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-gateway
.
- Amazon CLI
-
To describe a gateway
The following
describe-gateway
example describes a gateway.aws iotsitewise describe-gateway \ --gateway-id
a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE
Output:
{ "gatewayId": "a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE", "gatewayName": "ExampleCorpGateway", "gatewayArn": "arn:aws:iotsitewise:us-west-2:123456789012:gateway/a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE", "gatewayPlatform": { "greengrass": { "groupArn": "arn:aws:greengrass:us-west-2:123456789012:/greengrass/groups/a1b2c3d4-5678-90ab-cdef-1b1b1EXAMPLE" } }, "gatewayCapabilitySummaries": [ { "capabilityNamespace": "iotsitewise:opcuacollector:1", "capabilitySyncStatus": "IN_SYNC" } ], "creationDate": 1588369971.457, "lastUpdateDate": 1588369971.457 }
For more information, see Ingesting data using a gateway
in the Amazon IoT SiteWise User Guide. -
For API details, see DescribeGateway
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-logging-options
.
- Amazon CLI
-
To retrieve the current Amazon IoT SiteWise logging options
The following
describe-logging-options
example retrieves the current Amazon IoT SiteWise logging options for your Amazon account in the current Region.aws iotsitewise describe-logging-options
Output:
{ "loggingOptions": { "level": "INFO" } }
For more information, see Monitoring Amazon IoT SiteWise with Amazon CloudWatch Logs
in the Amazon IoT SiteWise User Guide. -
For API details, see DescribeLoggingOptions
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-portal
.
- Amazon CLI
-
To describe a portal
The following
describe-portal
example describes a web portal for a wind farm company.aws iotsitewise describe-portal \ --portal-id
a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE
Output:
{ "portalId": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE", "portalArn": "arn:aws:iotsitewise:us-west-2:123456789012:portal/a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE", "portalName": "WindFarmPortal", "portalDescription": "A portal that contains wind farm projects for Example Corp.", "portalClientId": "E-a1b2c3d4e5f6_a1b2c3d4e5f6EXAMPLE", "portalStartUrl": "https://a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE.app.iotsitewise.aws", "portalContactEmail": "support@example.com", "portalStatus": { "state": "ACTIVE" }, "portalCreationDate": "2020-02-04T23:01:52.90248068Z", "portalLastUpdateDate": "2020-02-04T23:01:52.90248078Z", "roleArn": "arn:aws:iam::123456789012:role/MySiteWiseMonitorServiceRole" }
For more information, see Administering your portals
in the Amazon IoT SiteWise User Guide. -
For API details, see DescribePortal
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-project
.
- Amazon CLI
-
To describe a project
The following
describe-project
example describes a wind farm project.aws iotsitewise describe-project \ --project-id
a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
Output:
{ "projectId": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE", "projectArn": "arn:aws:iotsitewise:us-west-2:123456789012:project/a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE", "projectName": "Wind Farm 1", "portalId": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE", "projectDescription": "Contains asset visualizations for Wind Farm #1 for Example Corp.", "projectCreationDate": "2020-02-20T21:58:43.362246001Z", "projectLastUpdateDate": "2020-02-20T21:58:43.362246095Z" }
For more information, see Viewing project details
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see DescribeProject
in Amazon CLI Command Reference.
-
The following code example shows how to use disassociate-assets
.
- Amazon CLI
-
To disassociate a child asset from a parent asset
The following
disassociate-assets
example disassociates a wind turbine asset from a wind farm asset.aws iotsitewise disassociate-assets \ --asset-id
a1b2c3d4-5678-90ab-cdef-44444EXAMPLE
\ --hierarchy-ida1b2c3d4-5678-90ab-cdef-77777EXAMPLE
\ --child-asset-ida1b2c3d4-5678-90ab-cdef-33333EXAMPLE
This command produces no output.
For more information, see Associating assets
in the Amazon IoT SiteWise User Guide. -
For API details, see DisassociateAssets
in Amazon CLI Command Reference.
-
The following code example shows how to use get-asset-property-aggregates
.
- Amazon CLI
-
To retrieve an asset property's aggregated average and count values
The following
get-asset-property-aggregates
example retrieves a wind turbine asset's average total power and count of total power data points for a 1 hour period in time.aws iotsitewise get-asset-property-aggregates \ --asset-id
a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
\ --property-ida1b2c3d4-5678-90ab-cdef-66666EXAMPLE
\ --start-date1580849400
\ --end-date1580853000
\ --aggregate-typesAVERAGE
COUNT
\ --resolution1h
Output:
{ "aggregatedValues": [ { "timestamp": 1580850000.0, "quality": "GOOD", "value": { "average": 8723.46538886233, "count": 12.0 } } ] }
For more information, see Querying asset property aggregates
in the Amazon IoT SiteWise User Guide. -
For API details, see GetAssetPropertyAggregates
in Amazon CLI Command Reference.
-
The following code example shows how to use get-asset-property-value-history
.
- Amazon CLI
-
To retrieve an asset property's historical values
The following
get-asset-property-value-history
example retrieves a wind turbine asset's total power values for a 20 minute period in time.aws iotsitewise get-asset-property-value-history \ --asset-id
a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
\ --property-ida1b2c3d4-5678-90ab-cdef-66666EXAMPLE
\ --start-date1580851800
\ --end-date1580853000
Output:
{ "assetPropertyValueHistory": [ { "value": { "doubleValue": 7217.787046814844 }, "timestamp": { "timeInSeconds": 1580852100, "offsetInNanos": 0 }, "quality": "GOOD" }, { "value": { "doubleValue": 6941.242811875451 }, "timestamp": { "timeInSeconds": 1580852400, "offsetInNanos": 0 }, "quality": "GOOD" }, { "value": { "doubleValue": 6976.797662266717 }, "timestamp": { "timeInSeconds": 1580852700, "offsetInNanos": 0 }, "quality": "GOOD" }, { "value": { "doubleValue": 6890.8677520453875 }, "timestamp": { "timeInSeconds": 1580853000, "offsetInNanos": 0 }, "quality": "GOOD" } ] }
For more information, see Querying historical asset property values
in the Amazon IoT SiteWise User Guide. -
For API details, see GetAssetPropertyValueHistory
in Amazon CLI Command Reference.
-
The following code example shows how to use get-asset-property-value
.
- Amazon CLI
-
To retrieve an asset property's current value
The following
get-asset-property-value
example retrieves a wind turbine asset's current total power.aws iotsitewise get-asset-property-value \ --asset-id
a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
\ --property-ida1b2c3d4-5678-90ab-cdef-66666EXAMPLE
Output:
{ "propertyValue": { "value": { "doubleValue": 6890.8677520453875 }, "timestamp": { "timeInSeconds": 1580853000, "offsetInNanos": 0 }, "quality": "GOOD" } }
For more information, see Querying current asset property values
in the Amazon IoT SiteWise User Guide. -
For API details, see GetAssetPropertyValue
in Amazon CLI Command Reference.
-
The following code example shows how to use list-access-policies
.
- Amazon CLI
-
To list all access policies
The following
list-access-policies
example lists all access policies for a user who is a portal administrator.aws iotsitewise list-access-policies \ --identity-type
USER
\ --identity-ida1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE
Output:
{ "accessPolicySummaries": [ { "id": "a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE", "identity": { "user": { "id": "a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE" } }, "resource": { "portal": { "id": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE" } }, "permission": "ADMINISTRATOR" } ] }
For more information, see Administering your portals
in the Amazon IoT SiteWise User Guide. -
For API details, see ListAccessPolicies
in Amazon CLI Command Reference.
-
The following code example shows how to use list-asset-models
.
- Amazon CLI
-
To list all asset models
The following
list-asset-models
example lists all asset models that are defined in your Amazon account in the current Region.aws iotsitewise list-asset-models
Output:
{ "assetModelSummaries": [ { "id": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "arn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "name": "Wind Farm Model", "description": "Represents a wind farm that comprises many wind turbines", "creationDate": 1575671284.0, "lastUpdateDate": 1575671988.0, "status": { "state": "ACTIVE" } }, { "id": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", "arn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", "name": "Wind Turbine Model", "description": "Represents a wind turbine manufactured by Example Corp", "creationDate": 1575671207.0, "lastUpdateDate": 1575686273.0, "status": { "state": "ACTIVE" } } ] }
For more information, see Listing all asset models
in the Amazon IoT SiteWise User Guide. -
For API details, see ListAssetModels
in Amazon CLI Command Reference.
-
The following code example shows how to use list-assets
.
- Amazon CLI
-
Example 1: To list all top-level assets
The following
list-assets
example lists all assets that are top-level in the asset hierarchy tree and defined in your Amazon account in the current Region.aws iotsitewise list-assets \ --filter
TOP_LEVEL
Output:
{ "assetSummaries": [ { "id": "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE", "arn": "arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-44444EXAMPLE", "name": "Wind Farm 1", "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "creationDate": 1575672453.0, "lastUpdateDate": 1575672453.0, "status": { "state": "ACTIVE" }, "hierarchies": [ { "id": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE", "name": "Wind Turbines" } ] } ] }
For more information, see Listing assets
in the Amazon IoT SiteWise User Guide. Example 2: To list all assets based on an asset model
The following
list-assets
example lists all assets based on an asset model and defined in your Amazon account in the current Region.aws iotsitewise list-assets \ --asset-model-id
a1b2c3d4-5678-90ab-cdef-11111EXAMPLE
Output:
{ "assetSummaries": [ { "id": "a1b2c3d4-5678-90ab-cdef-33333EXAMPLE", "arn": "arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE", "name": "Wind Turbine 1", "assetModelId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", "creationDate": 1575671550.0, "lastUpdateDate": 1575686308.0, "status": { "state": "ACTIVE" }, "hierarchies": [] } ] }
For more information, see Listing assets
in the Amazon IoT SiteWise User Guide. -
For API details, see ListAssets
in Amazon CLI Command Reference.
-
The following code example shows how to use list-associated-assets
.
- Amazon CLI
-
To list all assets associated to an asset in a specific hierarchy
The following
list-associated-assets
example lists all wind turbine assets associated to the specified wind farm asset.aws iotsitewise list-associated-assets \ --asset-id
a1b2c3d4-5678-90ab-cdef-44444EXAMPLE
\ --hierarchy-ida1b2c3d4-5678-90ab-cdef-77777EXAMPLE
Output:
{ "assetSummaries": [ { "id": "a1b2c3d4-5678-90ab-cdef-33333EXAMPLE", "arn": "arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE", "name": "Wind Turbine 1", "assetModelId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", "creationDate": 1575671550.0, "lastUpdateDate": 1575686308.0, "status": { "state": "ACTIVE" }, "hierarchies": [] } ] }
For more information, see Listing assets associated to a specific asset
in the Amazon IoT SiteWise User Guide. -
For API details, see ListAssociatedAssets
in Amazon CLI Command Reference.
-
The following code example shows how to use list-dashboards
.
- Amazon CLI
-
To list all dashboards in a project
The following
list-dashboards
example lists all dashboards that are defined in a project.aws iotsitewise list-dashboards \ --project-id
a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
Output:
{ "dashboardSummaries": [ { "id": "a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE", "name": "Wind Farm", "creationDate": "2020-05-01T20:32:12.228476348Z", "lastUpdateDate": "2020-05-01T20:32:12.228476348Z" } ] }
For more information, see Viewing dashboards
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see ListDashboards
in Amazon CLI Command Reference.
-
The following code example shows how to use list-gateways
.
- Amazon CLI
-
To list all gateways
The following
list-gateways
example lists all gateways that are defined in your Amazon account in the current Region.aws iotsitewise list-gateways
Output:
{ "gatewaySummaries": [ { "gatewayId": "a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE", "gatewayName": "ExampleCorpGateway", "gatewayCapabilitySummaries": [ { "capabilityNamespace": "iotsitewise:opcuacollector:1", "capabilitySyncStatus": "IN_SYNC" } ], "creationDate": 1588369971.457, "lastUpdateDate": 1588369971.457 } ] }
For more information, see Ingesting data using a gateway
in the Amazon IoT SiteWise User Guide. -
For API details, see ListGateways
in Amazon CLI Command Reference.
-
The following code example shows how to use list-portals
.
- Amazon CLI
-
To list all portals
The following
list-portals
example lists all portals that are defined in your Amazon account in the current Region.aws iotsitewise list-portals
Output:
{ "portalSummaries": [ { "id": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE", "name": "WindFarmPortal", "description": "A portal that contains wind farm projects for Example Corp.", "startUrl": "https://a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE.app.iotsitewise.aws", "creationDate": "2020-02-04T23:01:52.90248068Z", "lastUpdateDate": "2020-02-04T23:01:52.90248078Z", "roleArn": "arn:aws:iam::123456789012:role/service-role/MySiteWiseMonitorServiceRole" } ] }
For more information, see Administering your portals
in the Amazon IoT SiteWise User Guide. -
For API details, see ListPortals
in Amazon CLI Command Reference.
-
The following code example shows how to use list-project-assets
.
- Amazon CLI
-
To list all assets associated to a project
The following
list-project-assets
example lists all assets that are associated to a wind farm project.aws iotsitewise list-projects \ --project-id
a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
Output:
{ "assetIds": [ "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE" ] }
For more information, see Adding assets to projects
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see ListProjectAssets
in Amazon CLI Command Reference.
-
The following code example shows how to use list-projects
.
- Amazon CLI
-
To list all projects in a portal
The following
list-projects
example lists all projects that are defined in a portal.aws iotsitewise list-projects \ --portal-id
a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE
Output:
{ "projectSummaries": [ { "id": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE", "name": "Wind Farm 1", "description": "Contains asset visualizations for Wind Farm #1 for Example Corp.", "creationDate": "2020-02-20T21:58:43.362246001Z", "lastUpdateDate": "2020-02-20T21:58:43.362246095Z" } ] }
For more information, see Viewing project details
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see ListProjects
in Amazon CLI Command Reference.
-
The following code example shows how to use list-tags-for-resource
.
- Amazon CLI
-
To list all tags for a resource
The following
list-tags-for-resource
example lists all tags for a wind turbine asset.aws iotsitewise list-tags-for-resource \ --resource-arn
arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
Output:
{ "tags": { "Owner": "richard-roe" } }
For more information, see Tagging your resources
in the Amazon IoT SiteWise User Guide. -
For API details, see ListTagsForResource
in Amazon CLI Command Reference.
-
The following code example shows how to use put-logging-options
.
- Amazon CLI
-
To specify the level of logging
The following
put-logging-options
example enablesINFO
level logging in Amazon IoT SiteWise. Other levels includeDEBUG
andOFF
.aws iotsitewise put-logging-options \ --logging-options
level=INFO
This command produces no output.
For more information, see Monitoring Amazon IoT SiteWise with Amazon CloudWatch Logs
in the Amazon IoT SiteWise User Guide. -
For API details, see PutLoggingOptions
in Amazon CLI Command Reference.
-
The following code example shows how to use tag-resource
.
- Amazon CLI
-
To add a tag to a resource
The following
tag-resource
example adds an owner tag to a wind turbine asset. This lets you control access to the asset based on who owns it.aws iotsitewise tag-resource \ --resource-arn
arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
\ --tagsOwner=richard-roe
This command produces no output.
For more information, see Tagging your resources
in the Amazon IoT SiteWise User Guide. -
For API details, see TagResource
in Amazon CLI Command Reference.
-
The following code example shows how to use untag-resource
.
- Amazon CLI
-
To remove a tag from a resource
The following
untag-resource
example removes an owner tag from a wind turbine asset.aws iotsitewise untag-resource \ --resource-arn
arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
\ --tag-keysOwner
This command produces no output.
For more information, see Tagging your resources
in the Amazon IoT SiteWise User Guide. -
For API details, see UntagResource
in Amazon CLI Command Reference.
-
The following code example shows how to use update-access-policy
.
- Amazon CLI
-
To grant a project viewer ownership of a project
The following
update-access-policy
example updates an access policy that grants a project viewer ownership of a project.aws iotsitewise update-access-policy \ --access-policy-id
a1b2c3d4-5678-90ab-cdef-dddddEXAMPLE
\ --cli-input-jsonfile://update-project-viewer-access-policy.json
Contents of
update-project-viewer-access-policy.json
:{ "accessPolicyIdentity": { "user": { "id": "a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE" } }, "accessPolicyPermission": "ADMINISTRATOR", "accessPolicyResource": { "project": { "id": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE" } } }
This command produces no output.
For more information, see Assigning project owners
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see UpdateAccessPolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use update-asset-model
.
- Amazon CLI
-
To update an asset model
The following
update-asset-model
example updates a wind farm asset model's description. This example includes the model's existing IDs and definitions, becauseupdate-asset-model
overwrites the existing model with the new model.aws iotsitewise update-asset-model \ --cli-input-json
file://update-wind-farm-model.json
Contents of
update-wind-farm-model.json
:{ "assetModelName": "Wind Farm Model", "assetModelDescription": "Represents a wind farm that comprises many wind turbines", "assetModelProperties": [ { "id": "a1b2c3d4-5678-90ab-cdef-88888EXAMPLE", "name": "Region", "dataType": "STRING", "type": { "attribute": {} } }, { "id": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE", "name": "Total Generated Power", "dataType": "DOUBLE", "unit": "kW", "type": { "metric": { "expression": "sum(power)", "variables": [ { "name": "power", "value": { "hierarchyId": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE", "propertyId": "a1b2c3d4-5678-90ab-cdef-66666EXAMPLE" } } ], "window": { "tumbling": { "interval": "1h" } } } } } ], "assetModelHierarchies": [ { "id": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE", "name": "Wind Turbines", "childAssetModelId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" } ] }
Output:
{ "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "assetModelArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "assetModelStatus": { "state": "CREATING" } }
For more information, see Updating asset models
in the Amazon IoT SiteWise User Guide. -
For API details, see UpdateAssetModel
in Amazon CLI Command Reference.
-
The following code example shows how to use update-asset-property
.
- Amazon CLI
-
Example 1: To update an asset property's alias
The following
update-asset-property
example updates a wind turbine asset's power property alias.aws iotsitewise update-asset-property \ --asset-id
a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
\ --property-ida1b2c3d4-5678-90ab-cdef-55555EXAMPLE
\ --property-alias"/examplecorp/windfarm/1/turbine/1/power"
\ --property-notification-stateDISABLED
This command produces no output.
For more information, see Mapping industrial data streams to asset properties
in the Amazon IoT SiteWise User Guide. Example 2: To enable asset property notifications
The following
update-asset-property
example enables asset property update notifications for a wind turbine asset's power property. Property value updates are published to the MQTT topic$aws/sitewise/asset-models/<assetModelId>/assets/<assetId>/properties/<propertyId>
, where each ID is replaced by the property, asset, and model ID of the asset property.aws iotsitewise update-asset-property \ --asset-id
a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
\ --property-ida1b2c3d4-5678-90ab-cdef-66666EXAMPLE
\ --property-notification-stateENABLED
\ --property-alias"/examplecorp/windfarm/1/turbine/1/power"
This command produces no output.
For more information, see Interacting with other services
in the Amazon IoT SiteWise User Guide. -
For API details, see UpdateAssetProperty
in Amazon CLI Command Reference.
-
The following code example shows how to use update-asset
.
- Amazon CLI
-
To update an asset's name
The following
update-asset
example updates a wind turbine asset's name.aws iotsitewise update-asset \ --asset-id
a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
\ --asset-name"Wind Turbine 2"
Output:
{ "assetStatus": { "state": "UPDATING" } }
For more information, see Updating assets
in the Amazon IoT SiteWise User Guide. -
For API details, see UpdateAsset
in Amazon CLI Command Reference.
-
The following code example shows how to use update-dashboard
.
- Amazon CLI
-
To update a dashboard
The following
update-dashboard
example changes the title of a dashboard's line chart that displays total generated power for a wind farm.aws iotsitewise update-dashboard \ --project-id
a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE
\ --dashboard-name"Wind Farm"
\ --dashboard-definitionfile://update-wind-farm-dashboard.json
Contents of
update-wind-farm-dashboard.json
:{ "widgets": [ { "type": "monitor-line-chart", "title": "Total Generated Power", "x": 0, "y": 0, "height": 3, "width": 3, "metrics": [ { "label": "Power", "type": "iotsitewise", "assetId": "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE", "propertyId": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE" } ] } ] }
This command produces no output.
For more information, see Creating dashboards (CLI)
in the Amazon IoT SiteWise User Guide. -
For API details, see UpdateDashboard
in Amazon CLI Command Reference.
-
The following code example shows how to use update-gateway-capability-configuration
.
- Amazon CLI
-
To update a gateway capability
The following
update-gateway-capability-configuration
example configures an OPC-UA source with the following properties:Trusts any certificate.Uses the Basic256 algorithm to secure messages.Uses the SignAndEncrypt mode to secure connections.Uses authentication credentials stored in an Amazon Secrets Manager secret.
aws iotsitewise update-gateway-capability-configuration \ --gateway-id
a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE
\ --capability-namespace"iotsitewise:opcuacollector:1"
\ --capability-configurationfile://opc-ua-capability-configuration.json
Contents of
opc-ua-capability-configuration.json
:{ "sources": [ { "name": "Wind Farm #1", "endpoint": { "certificateTrust": { "type": "TrustAny" }, "endpointUri": "opc.tcp://203.0.113.0:49320", "securityPolicy": "BASIC256", "messageSecurityMode": "SIGN_AND_ENCRYPT", "identityProvider": { "type": "Username", "usernameSecretArn": "arn:aws:secretsmanager:us-west-2:123456789012:secret:greengrass-windfarm1-auth-1ABCDE" }, "nodeFilterRules": [] }, "measurementDataStreamPrefix": "" } ] }
Output:
{ "capabilityNamespace": "iotsitewise:opcuacollector:1", "capabilitySyncStatus": "OUT_OF_SYNC" }
For more information, see Configuring data sources
in the Amazon IoT SiteWise User Guide. -
For API details, see UpdateGatewayCapabilityConfiguration
in Amazon CLI Command Reference.
-
The following code example shows how to use update-gateway
.
- Amazon CLI
-
To update a gateway's name
The following
update-gateway
example updates a gateway's name.aws iotsitewise update-gateway \ --gateway-id
a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE
\ --gateway-nameExampleCorpGateway1
This command produces no output.
For more information, see Ingesting data using a gateway
in the Amazon IoT SiteWise User Guide. -
For API details, see UpdateGateway
in Amazon CLI Command Reference.
-
The following code example shows how to use update-portal
.
- Amazon CLI
-
To update a portal's details
The following
update-portal
example updates a web portal for a wind farm company.aws iotsitewise update-portal \ --portal-id
a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE
\ --portal-nameWindFarmPortal
\ --portal-description"A portal that contains wind farm projects for Example Corp."
\ --portal-contact-emailsupport@example.com
\ --role-arnarn:aws:iam::123456789012:role/MySiteWiseMonitorServiceRole
Output:
{ "portalStatus": { "state": "UPDATING" } }
For more information, see Administering your portals
in the Amazon IoT SiteWise User Guide. -
For API details, see UpdatePortal
in Amazon CLI Command Reference.
-
The following code example shows how to use update-project
.
- Amazon CLI
-
To update a project's details
The following
update-project
example updates a wind farm project.aws iotsitewise update-project \ --project-id
a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
\ --project-name"Wind Farm 1"
\ --project-description"Contains asset visualizations for Wind Farm #1 for Example Corp."
This command produces no output.
For more information, see Changing project details
in the Amazon IoT SiteWise Monitor Application Guide. -
For API details, see UpdateProject
in Amazon CLI Command Reference.
-