There are more AWS SDK examples available in the AWS Doc SDK Examples
AWS IoT SiteWise examples using AWS CLI
The following code examples show you how to perform actions and implement common scenarios by using the AWS Command Line Interface with AWS 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.
- AWS CLI
-
To associate a child asset to a parent asset
The following
associate-assetsexample 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-ida1b2c3d4-5678-90ab-cdef-44444EXAMPLE\ --hierarchy-ida1b2c3d4-5678-90ab-cdef-77777EXAMPLE\ --child-asset-ida1b2c3d4-5678-90ab-cdef-33333EXAMPLEThis command produces no output.
For more information, see Associating assets in the AWS IoT SiteWise User Guide.
-
For API details, see AssociateAssets
in AWS CLI Command Reference.
-
The following code example shows how to use batch-associate-project-assets.
- AWS CLI
-
To associate an asset to a project
The following
batch-associate-project-assetsexample associates a wind farm asset to a project.aws iotsitewise batch-associate-project-assets \ --project-ida1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE\ --asset-idsa1b2c3d4-5678-90ab-cdef-44444EXAMPLEThis command produces no output.
For more information, see Adding assets to projects in the AWS IoT SiteWise Monitor Application Guide.
-
For API details, see BatchAssociateProjectAssets
in AWS CLI Command Reference.
-
The following code example shows how to use batch-disassociate-project-assets.
- AWS CLI
-
To disassociate an asset from a project
The following
batch-disassociate-project-assetsexample disassociates a wind farm asset from a project.aws iotsitewise batch-disassociate-project-assets \ --project-ida1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE\ --asset-idsa1b2c3d4-5678-90ab-cdef-44444EXAMPLEThis command produces no output.
For more information, see Adding assets to projects in the AWS IoT SiteWise Monitor Application Guide.
-
For API details, see BatchDisassociateProjectAssets
in AWS CLI Command Reference.
-
The following code example shows how to use batch-put-asset-property-value.
- AWS CLI
-
To send data to asset properties
The following
batch-put-asset-property-valueexample sends power and temperature data to the asset properties identified by property aliases.aws iotsitewise batch-put-asset-property-value \ --cli-input-jsonfile://batch-put-asset-property-value.jsonContents 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 AWS IoT SiteWise API in the AWS IoT SiteWise User Guide.
-
For API details, see BatchPutAssetPropertyValue
in AWS CLI Command Reference.
-
The following code example shows how to use create-access-policy.
- AWS CLI
-
Example 1: To grant a user administrative access to a portal
The following
create-access-policyexample 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-jsonfile://create-portal-administrator-access-policy.jsonContents 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 AWS IoT SiteWise User Guide.
Example 2: To grant a user read-only access to a project
The following
create-access-policyexample creates an access policy that grants a user read-only access to a wind farm project.aws iotsitewise create-access-policy \ --cli-input-jsonfile://create-project-viewer-access-policy.jsonContents 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 AWS IoT SiteWise Monitor Application Guide.
-
For API details, see CreateAccessPolicy
in AWS CLI Command Reference.
-
The following code example shows how to use create-asset-model.
- AWS CLI
-
To create an asset model
The following
create-asset-modelexample 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-jsonfile://create-wind-turbine-model.jsonContents 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.
-
For API details, see CreateAssetModel
in AWS CLI Command Reference.
-
The following code example shows how to use create-asset.
- AWS CLI
-
To create an asset
The following
create-assetexample creates a wind turbine asset from a wind turbine asset model.aws iotsitewise create-asset \ --asset-model-ida1b2c3d4-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 AWS IoT SiteWise User Guide.
-
For API details, see CreateAsset
in AWS CLI Command Reference.
-
The following code example shows how to use create-dashboard.
- AWS CLI
-
To create a dashboard
The following
create-dashboardexample creates a dashboard with a line chart that displays total generated power for a wind farm.aws iotsitewise create-dashboard \ --project-ida1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE\ --dashboard-name"Wind Farm"\ --dashboard-definitionfile://create-wind-farm-dashboard.jsonContents 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 AWS IoT SiteWise User Guide.
-
For API details, see CreateDashboard
in AWS CLI Command Reference.
-
The following code example shows how to use create-gateway.
- AWS CLI
-
To create a gateway
The following
create-gatewayexample creates a gateway that runs on AWS IoT Greengrass.aws iotsitewise create-gateway \ --gateway-nameExampleCorpGateway\ --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 AWS IoT SiteWise User Guide.
-
For API details, see CreateGateway
in AWS CLI Command Reference.
-
The following code example shows how to use create-portal.
- AWS CLI
-
To create a portal
The following
create-portalexample creates a web portal for a wind farm company. You can create portals only in the same Region where you enabled AWS Single Sign-On.aws iotsitewise create-portal \ --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/service-role/MySiteWiseMonitorServiceRoleOutput:
{ "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 AWS IoT SiteWise Monitor in the AWS IoT SiteWise User Guide and Enabling AWS SSO in the AWS IoT SiteWise User Guide..
-
For API details, see CreatePortal
in AWS CLI Command Reference.
-
The following code example shows how to use create-project.
- AWS CLI
-
To create a project
The following
create-projectexample creates a wind farm project.aws iotsitewise create-project \ --portal-ida1b2c3d4-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 AWS IoT SiteWise Monitor Application Guide.
-
For API details, see CreateProject
in AWS CLI Command Reference.
-
The following code example shows how to use delete-access-policy.
- AWS CLI
-
To revoke a user's access to a project or portal
The following
delete-access-policyexample deletes an access policy that grants a user administrative access to a portal.aws iotsitewise delete-access-policy \ --access-policy-ida1b2c3d4-5678-90ab-cdef-cccccEXAMPLEThis command produces no output.
For more information, see Adding or removing portal administrators in the AWS IoT SiteWise User Guide.
-
For API details, see DeleteAccessPolicy
in AWS CLI Command Reference.
-
The following code example shows how to use delete-asset-model.
- AWS CLI
-
To delete an asset model
The following
delete-asset-modelexample deletes a wind turbine asset model.aws iotsitewise delete-asset-model \ --asset-model-ida1b2c3d4-5678-90ab-cdef-11111EXAMPLEOutput:
{ "assetModelStatus": { "state": "DELETING" } }For more information, see Deleting asset models in the AWS IoT SiteWise User Guide.
-
For API details, see DeleteAssetModel
in AWS CLI Command Reference.
-
The following code example shows how to use delete-asset.
- AWS CLI
-
To delete an asset
The following
delete-assetexample deletes a wind turbine asset.aws iotsitewise delete-asset \ --asset-ida1b2c3d4-5678-90ab-cdef-33333EXAMPLEOutput:
{ "assetStatus": { "state": "DELETING" } }For more information, see Deleting assets in the AWS IoT SiteWise User Guide.
-
For API details, see DeleteAsset
in AWS CLI Command Reference.
-
The following code example shows how to use delete-dashboard.
- AWS CLI
-
To delete a dashboard
The following
delete-dashboardexample deletes a wind turbine dashboard.aws iotsitewise delete-dashboard \ --dashboard-ida1b2c3d4-5678-90ab-cdef-fffffEXAMPLEThis command produces no output.
For more information, see Deleting dashboards in the AWS IoT SiteWise Monitor Application Guide.
-
For API details, see DeleteDashboard
in AWS CLI Command Reference.
-
The following code example shows how to use delete-gateway.
- AWS CLI
-
To delete a gateway
The following
delete-gatewayexample deletes a gateway.aws iotsitewise delete-gateway \ --gateway-ida1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLEThis command produces no output.
For more information, see Ingesting data using a gateway in the AWS IoT SiteWise User Guide.
-
For API details, see DeleteGateway
in AWS CLI Command Reference.
-
The following code example shows how to use delete-portal.
- AWS CLI
-
To delete a portal
The following
delete-portalexample deletes a web portal for a wind farm company.aws iotsitewise delete-portal \ --portal-ida1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLEOutput:
{ "portalStatus": { "state": "DELETING" } }For more information, see Deleting a portal in the AWS IoT SiteWise User Guide.
-
For API details, see DeletePortal
in AWS CLI Command Reference.
-
The following code example shows how to use delete-project.
- AWS CLI
-
To delete a project
The following
delete-projectexample deletes a wind farm project.aws iotsitewise delete-project \ --project-ida1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLEThis command produces no output.
For more information, see Deleting projects in the AWS IoT SiteWise Monitor Application Guide.
-
For API details, see DeleteProject
in AWS CLI Command Reference.
-
The following code example shows how to use describe-access-policy.
- AWS CLI
-
To describe an access policy
The following
describe-access-policyexample 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-ida1b2c3d4-5678-90ab-cdef-cccccEXAMPLEOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see DescribeAccessPolicy
in AWS CLI Command Reference.
-
The following code example shows how to use describe-asset-model.
- AWS CLI
-
To describe an asset model
The following
describe-asset-modelexample describes a wind farm asset model.aws iotsitewise describe-asset-model \ --asset-model-ida1b2c3d4-5678-90ab-cdef-22222EXAMPLEOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see DescribeAssetModel
in AWS CLI Command Reference.
-
The following code example shows how to use describe-asset-property.
- AWS CLI
-
To describe an asset property
The following
describe-asset-propertyexample describes a wind farm asset's total generated power property.aws iotsitewise describe-asset-property \ --asset-ida1b2c3d4-5678-90ab-cdef-44444EXAMPLE\ --property-ida1b2c3d4-5678-90ab-cdef-99999EXAMPLEOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see DescribeAssetProperty
in AWS CLI Command Reference.
-
The following code example shows how to use describe-asset.
- AWS CLI
-
To describe an asset
The following
describe-assetexample describes a wind farm asset.aws iotsitewise describe-asset \ --asset-ida1b2c3d4-5678-90ab-cdef-44444EXAMPLEOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see DescribeAsset
in AWS CLI Command Reference.
-
The following code example shows how to use describe-dashboard.
- AWS CLI
-
To describe a dashboard
The following
describe-dashboardexample describes the specified wind farm dashboard.aws iotsitewise describe-dashboard \ --dashboard-ida1b2c3d4-5678-90ab-cdef-fffffEXAMPLEOutput:
{ "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 AWS IoT SiteWise Monitor Application Guide.
-
For API details, see DescribeDashboard
in AWS CLI Command Reference.
-
The following code example shows how to use describe-gateway-capability-configuration.
- AWS CLI
-
To describe a gateway capability
The following
describe-gateway-capability-configurationexample describes an OPC-UA source capability.aws iotsitewise describe-gateway-capability-configuration \ --gateway-ida1b2c3d4-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 AWS IoT SiteWise User Guide.
-
For API details, see DescribeGatewayCapabilityConfiguration
in AWS CLI Command Reference.
-
The following code example shows how to use describe-gateway.
- AWS CLI
-
To describe a gateway
The following
describe-gatewayexample describes a gateway.aws iotsitewise describe-gateway \ --gateway-ida1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLEOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see DescribeGateway
in AWS CLI Command Reference.
-
The following code example shows how to use describe-logging-options.
- AWS CLI
-
To retrieve the current AWS IoT SiteWise logging options
The following
describe-logging-optionsexample retrieves the current AWS IoT SiteWise logging options for your AWS account in the current Region.aws iotsitewise describe-logging-optionsOutput:
{ "loggingOptions": { "level": "INFO" } }For more information, see Monitoring AWS IoT SiteWise with Amazon CloudWatch Logs in the AWS IoT SiteWise User Guide.
-
For API details, see DescribeLoggingOptions
in AWS CLI Command Reference.
-
The following code example shows how to use describe-portal.
- AWS CLI
-
To describe a portal
The following
describe-portalexample describes a web portal for a wind farm company.aws iotsitewise describe-portal \ --portal-ida1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLEOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see DescribePortal
in AWS CLI Command Reference.
-
The following code example shows how to use describe-project.
- AWS CLI
-
To describe a project
The following
describe-projectexample describes a wind farm project.aws iotsitewise describe-project \ --project-ida1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLEOutput:
{ "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 AWS IoT SiteWise Monitor Application Guide.
-
For API details, see DescribeProject
in AWS CLI Command Reference.
-
The following code example shows how to use disassociate-assets.
- AWS CLI
-
To disassociate a child asset from a parent asset
The following
disassociate-assetsexample disassociates a wind turbine asset from a wind farm asset.aws iotsitewise disassociate-assets \ --asset-ida1b2c3d4-5678-90ab-cdef-44444EXAMPLE\ --hierarchy-ida1b2c3d4-5678-90ab-cdef-77777EXAMPLE\ --child-asset-ida1b2c3d4-5678-90ab-cdef-33333EXAMPLEThis command produces no output.
For more information, see Associating assets in the AWS IoT SiteWise User Guide.
-
For API details, see DisassociateAssets
in AWS CLI Command Reference.
-
The following code example shows how to use get-asset-property-aggregates.
- AWS CLI
-
To retrieve an asset property's aggregated average and count values
The following
get-asset-property-aggregatesexample 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-ida1b2c3d4-5678-90ab-cdef-33333EXAMPLE\ --property-ida1b2c3d4-5678-90ab-cdef-66666EXAMPLE\ --start-date1580849400\ --end-date1580853000\ --aggregate-typesAVERAGECOUNT\ --resolution1hOutput:
{ "aggregatedValues": [ { "timestamp": 1580850000.0, "quality": "GOOD", "value": { "average": 8723.46538886233, "count": 12.0 } } ] }For more information, see Querying asset property aggregates in the AWS IoT SiteWise User Guide.
-
For API details, see GetAssetPropertyAggregates
in AWS CLI Command Reference.
-
The following code example shows how to use get-asset-property-value-history.
- AWS CLI
-
To retrieve an asset property's historical values
The following
get-asset-property-value-historyexample retrieves a wind turbine asset's total power values for a 20 minute period in time.aws iotsitewise get-asset-property-value-history \ --asset-ida1b2c3d4-5678-90ab-cdef-33333EXAMPLE\ --property-ida1b2c3d4-5678-90ab-cdef-66666EXAMPLE\ --start-date1580851800\ --end-date1580853000Output:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see GetAssetPropertyValueHistory
in AWS CLI Command Reference.
-
The following code example shows how to use get-asset-property-value.
- AWS CLI
-
To retrieve an asset property's current value
The following
get-asset-property-valueexample retrieves a wind turbine asset's current total power.aws iotsitewise get-asset-property-value \ --asset-ida1b2c3d4-5678-90ab-cdef-33333EXAMPLE\ --property-ida1b2c3d4-5678-90ab-cdef-66666EXAMPLEOutput:
{ "propertyValue": { "value": { "doubleValue": 6890.8677520453875 }, "timestamp": { "timeInSeconds": 1580853000, "offsetInNanos": 0 }, "quality": "GOOD" } }For more information, see Querying current asset property values in the AWS IoT SiteWise User Guide.
-
For API details, see GetAssetPropertyValue
in AWS CLI Command Reference.
-
The following code example shows how to use list-access-policies.
- AWS CLI
-
To list all access policies
The following
list-access-policiesexample lists all access policies for a user who is a portal administrator.aws iotsitewise list-access-policies \ --identity-typeUSER\ --identity-ida1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLEOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see ListAccessPolicies
in AWS CLI Command Reference.
-
The following code example shows how to use list-asset-models.
- AWS CLI
-
To list all asset models
The following
list-asset-modelsexample lists all asset models that are defined in your AWS account in the current Region.aws iotsitewise list-asset-modelsOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see ListAssetModels
in AWS CLI Command Reference.
-
The following code example shows how to use list-assets.
- AWS CLI
-
Example 1: To list all top-level assets
The following
list-assetsexample lists all assets that are top-level in the asset hierarchy tree and defined in your AWS account in the current Region.aws iotsitewise list-assets \ --filterTOP_LEVELOutput:
{ "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 AWS IoT SiteWise User Guide.
Example 2: To list all assets based on an asset model
The following
list-assetsexample lists all assets based on an asset model and defined in your AWS account in the current Region.aws iotsitewise list-assets \ --asset-model-ida1b2c3d4-5678-90ab-cdef-11111EXAMPLEOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see ListAssets
in AWS CLI Command Reference.
-
The following code example shows how to use list-associated-assets.
- AWS CLI
-
To list all assets associated to an asset in a specific hierarchy
The following
list-associated-assetsexample lists all wind turbine assets associated to the specified wind farm asset.aws iotsitewise list-associated-assets \ --asset-ida1b2c3d4-5678-90ab-cdef-44444EXAMPLE\ --hierarchy-ida1b2c3d4-5678-90ab-cdef-77777EXAMPLEOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see ListAssociatedAssets
in AWS CLI Command Reference.
-
The following code example shows how to use list-dashboards.
- AWS CLI
-
To list all dashboards in a project
The following
list-dashboardsexample lists all dashboards that are defined in a project.aws iotsitewise list-dashboards \ --project-ida1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLEOutput:
{ "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 AWS IoT SiteWise Monitor Application Guide.
-
For API details, see ListDashboards
in AWS CLI Command Reference.
-
The following code example shows how to use list-gateways.
- AWS CLI
-
To list all gateways
The following
list-gatewaysexample lists all gateways that are defined in your AWS account in the current Region.aws iotsitewise list-gatewaysOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see ListGateways
in AWS CLI Command Reference.
-
The following code example shows how to use list-portals.
- AWS CLI
-
To list all portals
The following
list-portalsexample lists all portals that are defined in your AWS account in the current Region.aws iotsitewise list-portalsOutput:
{ "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 AWS IoT SiteWise User Guide.
-
For API details, see ListPortals
in AWS CLI Command Reference.
-
The following code example shows how to use list-project-assets.
- AWS CLI
-
To list all assets associated to a project
The following
list-project-assetsexample lists all assets that are associated to a wind farm project.aws iotsitewise list-projects \ --project-ida1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLEOutput:
{ "assetIds": [ "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE" ] }For more information, see Adding assets to projects in the AWS IoT SiteWise Monitor Application Guide.
-
For API details, see ListProjectAssets
in AWS CLI Command Reference.
-
The following code example shows how to use list-projects.
- AWS CLI
-
To list all projects in a portal
The following
list-projectsexample lists all projects that are defined in a portal.aws iotsitewise list-projects \ --portal-ida1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLEOutput:
{ "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 AWS IoT SiteWise Monitor Application Guide.
-
For API details, see ListProjects
in AWS CLI Command Reference.
-
The following code example shows how to use list-tags-for-resource.
- AWS CLI
-
To list all tags for a resource
The following
list-tags-for-resourceexample lists all tags for a wind turbine asset.aws iotsitewise list-tags-for-resource \ --resource-arnarn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLEOutput:
{ "tags": { "Owner": "richard-roe" } }For more information, see Tagging your resources in the AWS IoT SiteWise User Guide.
-
For API details, see ListTagsForResource
in AWS CLI Command Reference.
-
The following code example shows how to use put-logging-options.
- AWS CLI
-
To specify the level of logging
The following
put-logging-optionsexample enablesINFOlevel logging in AWS IoT SiteWise. Other levels includeDEBUGandOFF.aws iotsitewise put-logging-options \ --logging-optionslevel=INFOThis command produces no output.
For more information, see Monitoring AWS IoT SiteWise with Amazon CloudWatch Logs in the AWS IoT SiteWise User Guide.
-
For API details, see PutLoggingOptions
in AWS CLI Command Reference.
-
The following code example shows how to use tag-resource.
- AWS CLI
-
To add a tag to a resource
The following
tag-resourceexample 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-arnarn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE\ --tagsOwner=richard-roeThis command produces no output.
For more information, see Tagging your resources in the AWS IoT SiteWise User Guide.
-
For API details, see TagResource
in AWS CLI Command Reference.
-
The following code example shows how to use untag-resource.
- AWS CLI
-
To remove a tag from a resource
The following
untag-resourceexample removes an owner tag from a wind turbine asset.aws iotsitewise untag-resource \ --resource-arnarn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE\ --tag-keysOwnerThis command produces no output.
For more information, see Tagging your resources in the AWS IoT SiteWise User Guide.
-
For API details, see UntagResource
in AWS CLI Command Reference.
-
The following code example shows how to use update-access-policy.
- AWS CLI
-
To grant a project viewer ownership of a project
The following
update-access-policyexample updates an access policy that grants a project viewer ownership of a project.aws iotsitewise update-access-policy \ --access-policy-ida1b2c3d4-5678-90ab-cdef-dddddEXAMPLE\ --cli-input-jsonfile://update-project-viewer-access-policy.jsonContents 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 AWS IoT SiteWise Monitor Application Guide.
-
For API details, see UpdateAccessPolicy
in AWS CLI Command Reference.
-
The following code example shows how to use update-asset-model.
- AWS CLI
-
To update an asset model
The following
update-asset-modelexample updates a wind farm asset model's description. This example includes the model's existing IDs and definitions, becauseupdate-asset-modeloverwrites the existing model with the new model.aws iotsitewise update-asset-model \ --cli-input-jsonfile://update-wind-farm-model.jsonContents 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 AWS IoT SiteWise User Guide.
-
For API details, see UpdateAssetModel
in AWS CLI Command Reference.
-
The following code example shows how to use update-asset-property.
- AWS CLI
-
Example 1: To update an asset property's alias
The following
update-asset-propertyexample updates a wind turbine asset's power property alias.aws iotsitewise update-asset-property \ --asset-ida1b2c3d4-5678-90ab-cdef-33333EXAMPLE\ --property-ida1b2c3d4-5678-90ab-cdef-55555EXAMPLE\ --property-alias"/examplecorp/windfarm/1/turbine/1/power"\ --property-notification-stateDISABLEDThis command produces no output.
For more information, see Mapping industrial data streams to asset properties in the AWS IoT SiteWise User Guide.
Example 2: To enable asset property notifications
The following
update-asset-propertyexample 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-ida1b2c3d4-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 AWS IoT SiteWise User Guide.
-
For API details, see UpdateAssetProperty
in AWS CLI Command Reference.
-
The following code example shows how to use update-asset.
- AWS CLI
-
To update an asset's name
The following
update-assetexample updates a wind turbine asset's name.aws iotsitewise update-asset \ --asset-ida1b2c3d4-5678-90ab-cdef-33333EXAMPLE\ --asset-name"Wind Turbine 2"Output:
{ "assetStatus": { "state": "UPDATING" } }For more information, see Updating assets in the AWS IoT SiteWise User Guide.
-
For API details, see UpdateAsset
in AWS CLI Command Reference.
-
The following code example shows how to use update-dashboard.
- AWS CLI
-
To update a dashboard
The following
update-dashboardexample changes the title of a dashboard's line chart that displays total generated power for a wind farm.aws iotsitewise update-dashboard \ --project-ida1b2c3d4-5678-90ab-cdef-fffffEXAMPLE\ --dashboard-name"Wind Farm"\ --dashboard-definitionfile://update-wind-farm-dashboard.jsonContents 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 AWS IoT SiteWise User Guide.
-
For API details, see UpdateDashboard
in AWS CLI Command Reference.
-
The following code example shows how to use update-gateway-capability-configuration.
- AWS CLI
-
To update a gateway capability
The following
update-gateway-capability-configurationexample 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 AWS Secrets Manager secret.
aws iotsitewise update-gateway-capability-configuration \ --gateway-ida1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE\ --capability-namespace"iotsitewise:opcuacollector:1"\ --capability-configurationfile://opc-ua-capability-configuration.jsonContents 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 AWS IoT SiteWise User Guide.
-
For API details, see UpdateGatewayCapabilityConfiguration
in AWS CLI Command Reference.
-
The following code example shows how to use update-gateway.
- AWS CLI
-
To update a gateway's name
The following
update-gatewayexample updates a gateway's name.aws iotsitewise update-gateway \ --gateway-ida1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE\ --gateway-nameExampleCorpGateway1This command produces no output.
For more information, see Ingesting data using a gateway in the AWS IoT SiteWise User Guide.
-
For API details, see UpdateGateway
in AWS CLI Command Reference.
-
The following code example shows how to use update-portal.
- AWS CLI
-
To update a portal's details
The following
update-portalexample updates a web portal for a wind farm company.aws iotsitewise update-portal \ --portal-ida1b2c3d4-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/MySiteWiseMonitorServiceRoleOutput:
{ "portalStatus": { "state": "UPDATING" } }For more information, see Administering your portals in the AWS IoT SiteWise User Guide.
-
For API details, see UpdatePortal
in AWS CLI Command Reference.
-
The following code example shows how to use update-project.
- AWS CLI
-
To update a project's details
The following
update-projectexample updates a wind farm project.aws iotsitewise update-project \ --project-ida1b2c3d4-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 AWS IoT SiteWise Monitor Application Guide.
-
For API details, see UpdateProject
in AWS CLI Command Reference.
-