Scaleway logo
Commands

Documentation for `scw iot`

The CLI documentation pages are currently under construction

The content is up to date. We're making improvements to the site over the next few weeks for a better experience.

This API allows you to manage your IoT hubs and devices.

IoT Device commands

IoT Device commands.

Add a device

Attach a device to a given Hub.

Usage:

TerminalCode
scw iot device create [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
nameDevice nameRequired
Default: <generated>
hub-idHub ID of the deviceRequired
allow-insecureDefines whether to allow plain and server-authenticated SSL connections in addition to mutually-authenticated ones
allow-multiple-connectionsDefines whether to allow multiple physical devices to connect with this device's credentials
message-filters.publish.policyHow to use the topic listOne of: unknown, accept, reject
message-filters.publish.topics.{index}List of topics to accept or reject. It must be valid MQTT topics and up to 65535 characters
message-filters.subscribe.policyHow to use the topic listOne of: unknown, accept, reject
message-filters.subscribe.topics.{index}List of topics to accept or reject. It must be valid MQTT topics and up to 65535 characters
descriptionDevice description
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Remove a device

Remove a specific device from the specific Hub it is attached to.

Usage:

TerminalCode
scw iot device delete <device-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
device-idDevice IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Disable a device

Disable an existing device, specified by its device ID.

Usage:

TerminalCode
scw iot device disable <device-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
device-idDevice IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Enable a device

Enable a specific device, specified by its device ID.

Usage:

TerminalCode
scw iot device enable <device-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
device-idDevice IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Get a device

Retrieve information about an existing device, specified by its device ID. Its full details, including name, status and ID, are returned in the response object.

Usage:

TerminalCode
scw iot device get <device-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
device-idDevice IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Get a device's certificate

Get information for a particular PEM-encoded certificate, specified by the device ID. The response returns full details of the device, including its type of certificate.

Usage:

TerminalCode
scw iot device get-certificate <device-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
device-idDevice IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Get a device's metrics

Get the metrics of an existing device, specified by its device ID.

Usage:

TerminalCode
scw iot device get-metrics <device-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
device-idDevice IDRequired
start-dateStart date used to compute the best scale for the returned metricsRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

List devices

List all devices in the specified region. By default, returned devices are ordered by creation date in ascending order, though this can be modified via the order_by field.

Usage:

TerminalCode
scw iot device list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
order-byOrdering of requested devicesOne of: name_asc, name_desc, status_asc, status_desc, hub_id_asc, hub_id_desc, created_at_asc, created_at_desc, updated_at_asc, updated_at_desc, allow_insecure_asc, allow_insecure_desc
nameName to filter for, only devices with this name will be returned
hub-idHub ID to filter for, only devices attached to this Hub will be returned
allow-insecureDefines whether to filter the allow_insecure flag
statusDevice status (enabled, disabled, etc.)One of: unknown, error, enabled, disabled
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, all

Renew a device certificate

Renew the certificate of an existing device, specified by its device ID.

Usage:

TerminalCode
scw iot device renew-certificate <device-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
device-idDevice IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Set a custom certificate on a device

Switch the existing certificate of a given device with an EM-encoded custom certificate.

Usage:

TerminalCode
scw iot device set-certificate <device-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
device-idDevice IDRequired
certificate-pemPEM-encoded custom certificateRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Update a device

Update the parameters of an existing device, specified by its device ID.

Usage:

TerminalCode
scw iot device update <device-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
device-idDevice IDRequired
descriptionDescription for the device
allow-insecureDefines whether to allow plain and server-authenticated SSL connections in addition to mutually-authenticated ones
allow-multiple-connectionsDefines whether to allow multiple physical devices to connect with this device's credentials
message-filters.publish.policyHow to use the topic listOne of: unknown, accept, reject
message-filters.publish.topics.{index}List of topics to accept or reject. It must be valid MQTT topics and up to 65535 characters
message-filters.subscribe.policyHow to use the topic listOne of: unknown, accept, reject
message-filters.subscribe.topics.{index}List of topics to accept or reject. It must be valid MQTT topics and up to 65535 characters
hub-idChange Hub for this device, additional fees may apply, see IoT Hub pricing
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

IoT Hub commands

IoT Hub commands.

Create a hub

Create a new Hub in the targeted region, specifying its configuration including name and product plan.

Usage:

TerminalCode
scw iot hub create [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
nameHub name (up to 255 characters)Required
Default: <generated>
project-idProject ID to use. If none is passed the default project ID will be used
product-planHub product planRequired
Default: plan_shared
One of: plan_unknown, plan_shared, plan_dedicated, plan_ha
disable-eventsDisable Hub events
events-topic-prefixTopic prefix (default '$SCW/events') of Hub events
twins-graphite-config.push-uri
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Delete a hub

Delete an existing IoT Hub, specified by its Hub ID. Deleting a Hub is permanent, and cannot be undone.

Usage:

TerminalCode
scw iot hub delete <hub-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
hub-idHub IDRequired
delete-devicesDefines whether to force the deletion of devices added to this Hub or reject the operation
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Disable a hub

Disable an existing IoT Hub, specified by its Hub ID.

Usage:

TerminalCode
scw iot hub disable <hub-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
hub-idHub IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Enable a hub

Enable an existing IoT Hub, specified by its Hub ID.

Usage:

TerminalCode
scw iot hub enable <hub-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
hub-idHub IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Get a hub

Retrieve information about an existing IoT Hub, specified by its Hub ID. Its full details, including name, status and endpoint, are returned in the response object.

Usage:

TerminalCode
scw iot hub get <hub-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
hub-idHub IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Get the certificate authority of a hub

Get information for a particular PEM-encoded certificate, specified by the Hub ID.

Usage:

TerminalCode
scw iot hub get-ca [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
hub-idRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

List hubs

List all Hubs in the specified zone. By default, returned Hubs are ordered by creation date in ascending order, though this can be modified via the order_by field.

Usage:

TerminalCode
scw iot hub list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
order-bySort order of Hubs in the responseOne of: name_asc, name_desc, status_asc, status_desc, product_plan_asc, product_plan_desc, created_at_asc, created_at_desc, updated_at_asc, updated_at_desc
project-idOnly list Hubs of this Project ID
nameHub name
organization-idOnly list Hubs of this Organization ID
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, all

Set the certificate authority of a hub

Set a particular PEM-encoded certificate, specified by the Hub ID.

Usage:

TerminalCode
scw iot hub set-ca <hub-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
hub-idHub IDRequired
ca-cert-pemCA's PEM-encoded certificateRequired
challenge-cert-pemProof of possession of PEM-encoded certificateRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Update a hub

Update the parameters of an existing IoT Hub, specified by its Hub ID.

Usage:

TerminalCode
scw iot hub update <hub-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
hub-idID of the Hub you want to updateRequired
nameHub name (up to 255 characters)
product-planHub product planOne of: plan_unknown, plan_shared, plan_dedicated, plan_ha
disable-eventsDisable Hub events
events-topic-prefixTopic prefix of Hub events
enable-device-auto-provisioningEnable device auto provisioning
twins-graphite-config.push-uri
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

IoT Network commands

IoT Network commands.

Create a new network

Create a new network for an existing hub. Beside the default network, you can add networks for different data providers. Possible network types are Sigfox and REST.

Usage:

TerminalCode
scw iot network create [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
nameNetwork nameRequired
Default: <generated>
typeType of network to connect withRequired
One of: unknown, sigfox, rest
hub-idHub ID to connect the Network toRequired
topic-prefixTopic prefix for the NetworkRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Delete a Network

Delete an existing network, specified by its network ID. Deleting a network is permanent, and cannot be undone.

Usage:

TerminalCode
scw iot network delete <network-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
network-idNetwork IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Retrieve a specific network

Retrieve an existing network, specified by its network ID. The response returns full details of the network, including its type, the topic prefix and its endpoint.

Usage:

TerminalCode
scw iot network get <network-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
network-idNetwork IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

List the networks

List the networks.

Usage:

TerminalCode
scw iot network list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
order-byOrdering of requested routesOne of: name_asc, name_desc, type_asc, type_desc, created_at_asc, created_at_desc
nameNetwork name to filter for
hub-idHub ID to filter for
topic-prefixTopic prefix to filter for
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, all

IoT Route commands

IoT Route commands.

Create a route

Multiple kinds of routes can be created, such as:

  • Database Route Create a route that will record subscribed MQTT messages into your database. You need to manage the database by yourself.
  • REST Route. Create a route that will call a REST API on received subscribed MQTT messages.
  • Amazon S3 Routes. Create a route that will put subscribed MQTT messages into an Object Storage bucket. You need to create the bucket yourself and grant write access. Granting can be done with s3cmd (s3cmd setacl s3://<my-bucket> --acl-grant=write:555c69c3-87d0-4bf8-80f1-99a2f757d031:555c69c3-87d0-4bf8-80f1-99a2f757d031).

Usage:

TerminalCode
scw iot route create [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
nameRoute nameDefault: <generated>
hub-idHub ID of the route
topicTopic the route subscribes to. It must be a valid MQTT topic and up to 65535 characters
s3-config.bucket-region
s3-config.bucket-name
s3-config.object-prefix
s3-config.strategyOne of: unknown, per_topic, per_message
db-config.host
db-config.port
db-config.dbname
db-config.username
db-config.password
db-config.query
db-config.engineOne of: unknown, postgresql, mysql
rest-config.verbOne of: unknown, get, post, put, patch, delete
rest-config.uri
rest-config.headers.{key}
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Delete a route

Delete an existing route, specified by its route ID. Deleting a route is permanent, and cannot be undone.

Usage:

TerminalCode
scw iot route delete <route-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
route-idRoute IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

Get a route

Get information for a particular route, specified by the route ID. The response returns full details of the route, including its type, the topic it subscribes to and its configuration.

Usage:

TerminalCode
scw iot route get <route-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
route-idRoute IDRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par

List routes

List all routes in the specified region. By default, returned routes are ordered by creation date in ascending order, though this can be modified via the order_by field.

Usage:

TerminalCode
scw iot route list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
order-byOrdering of requested routesOne of: name_asc, name_desc, hub_id_asc, hub_id_desc, type_asc, type_desc, created_at_asc, created_at_desc
hub-idHub ID to filter for
nameRoute name to filter for
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, all

Update a route

Update the parameters of an existing route, specified by its route ID.

Usage:

TerminalCode
scw iot route update [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
route-idRoute idRequired
nameRoute name
topicTopic the route subscribes to. It must be a valid MQTT topic and up to 65535 characters
s3-config.bucket-region
s3-config.bucket-name
s3-config.object-prefix
s3-config.strategyOne of: unknown, per_topic, per_message
db-config.host
db-config.port
db-config.dbname
db-config.username
db-config.password
db-config.query
db-config.engineOne of: unknown, postgresql, mysql
rest-config.verbOne of: unknown, get, post, put, patch, delete
rest-config.uri
rest-config.headers.{key}
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par