Skip to main content

commands

Creates, updates, deletes, gets or lists a commands resource.

Overview

Namecommands
TypeResource
Idaws.iot.commands

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
command_arnstringThe Amazon Resource Number (ARN) of the command. For example, arn:aws:iot:<region>:<accountid>:command/<commandId>
command_idstringThe unique identifier of the command. (pattern: <code>[a-zA-Z0-9_-]+</code>)
created_atstring (date-time)The timestamp, when the command was created.
deprecated_booleanIndicates whether the command has been deprecated.
descriptionstringA short text description of the command. (pattern: <code>[^\p{C}]*</code>)
display_namestringThe user-friendly name in the console for the command. (pattern: <code>[^\p{C}]*</code>)
last_updated_atstring (date-time)The timestamp, when the command was last updated.
mandatory_parametersarrayA list of parameters for the command created.
namespacestringThe namespace of the command. (AWS-IoT, AWS-IoT-FleetWise)
payloadobjectThe command payload object that contains the instructions for the device to process.
payload_templatestringThe payload template for the dynamic command.
pending_deletionbooleanIndicates whether the command is being deleted.
preprocessorobjectConfiguration that determines how the payloadTemplate is processed by the service to generate the final payload sent to devices at StartCommandExecution API invocation.
role_arnstringThe IAM role that you provided when creating the command with AWS-IoT-FleetWise as the namespace.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_commandselectcommand_id, regionGets information about the specified command.
list_commandsselectregionmaxResults, nextToken, namespace, commandParameterName, sortOrderList all commands in your account.
create_commandinsertcommand_id, regionCreates a command. A command contains reusable configurations that can be applied before they are sent to the devices.
update_commandupdatecommand_id, regionUpdate information about a command or mark a command for deprecation.
delete_commanddeletecommand_id, regionDelete a command resource.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
command_idstringThe unique identifier of the command to be deleted.
regionstringAWS region (default: us-east-1)
commandParameterNamestringA filter that can be used to display the list of commands that have a specific command parameter name.
maxResultsintegerThe maximum number of results to return in this operation. By default, the API returns up to a maximum of 25 results. You can override this default value to return up to a maximum of 100 results for this operation.
namespacestringThe namespace of the command. By default, the API returns all commands that have been created for both AWS-IoT and AWS-IoT-FleetWise namespaces. You can override this default value if you want to return all commands that have been created only for a specific namespace.
nextTokenstringTo retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.
sortOrderstringSpecify whether to list the commands that you have created in the ascending or descending order. By default, the API returns all commands in the descending order based on the time that they were created.

SELECT examples

Gets information about the specified command.

SELECT
command_arn,
command_id,
created_at,
deprecated_,
description,
display_name,
last_updated_at,
mandatory_parameters,
namespace,
payload,
payload_template,
pending_deletion,
preprocessor,
role_arn
FROM aws.iot.commands
WHERE command_id = '{{ command_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a command. A command contains reusable configurations that can be applied before they are sent to the devices.

INSERT INTO aws.iot.commands (
namespace,
displayName,
description,
payload,
payloadTemplate,
preprocessor,
mandatoryParameters,
roleArn,
tags,
command_id,
region
)
SELECT
'{{ namespace }}',
'{{ displayName }}',
'{{ description }}',
'{{ payload }}',
'{{ payloadTemplate }}',
'{{ preprocessor }}',
'{{ mandatoryParameters }}',
'{{ roleArn }}',
'{{ tags }}',
'{{ command_id }}',
'{{ region }}'
RETURNING
command_arn,
command_id
;

UPDATE examples

Update information about a command or mark a command for deprecation.

UPDATE aws.iot.commands
SET
displayName = '{{ displayName }}',
description = '{{ description }}',
deprecated = {{ deprecated }}
WHERE
command_id = '{{ command_id }}' --required
AND region = '{{ region }}' --required
RETURNING
command_id,
deprecated_,
description,
display_name,
last_updated_at;

DELETE examples

Delete a command resource.

DELETE FROM aws.iot.commands
WHERE command_id = '{{ command_id }}' --required
AND region = '{{ region }}' --required
;