Skip to main content

things

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

Overview

Namethings
TypeResource
Idaws.iot.things

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
attributesobjectThe thing attributes.
billing_group_namestringThe name of the billing group the thing belongs to. (pattern: <code>[a-zA-Z0-9:_-]+</code>)
default_client_idstringThe default MQTT client ID. For a typical device, the thing name is also used as the default MQTT client ID. Although we don’t require a mapping between a thing's registry name and its use of MQTT client IDs, certificates, or shadow state, we recommend that you choose a thing name and use it as the MQTT client ID for the registry and the Device Shadow service. This lets you better organize your IoT fleet without removing the flexibility of the underlying device certificate model or shadows.
thing_arnstringThe ARN of the thing to describe.
thing_idstringThe ID of the thing to describe.
thing_namestringThe name of the thing. (pattern: <code>[a-zA-Z0-9:_-]+</code>)
thing_type_namestringThe thing type name. (pattern: <code>[a-zA-Z0-9:_-]+</code>)
versioninteger (int64)The current version of the thing record in the registry. To avoid unintentional changes to the information in the registry, you can pass the version information in the expectedVersion parameter of the UpdateThing and DeleteThing calls.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_thingselectthing_name, regionGets information about the specified thing. Requires permission to access the DescribeThing action.
list_thingsselectregionnextToken, maxResults, attributeName, attributeValue, thingTypeName, usePrefixAttributeValueLists your things. Use the attributeName and attributeValue parameters to filter your things. For example, calling ListThings with attributeName=Color and attributeValue=Red retrieves all things in the registry that contain an attribute Color with the value Red. For more information, see List Things from the Amazon Web Services IoT Core Developer Guide. Requires permission to access the ListThings action. You will not be charged for calling this API if an Access denied error is returned. You will also not be charged if no attributes or pagination token was provided in request and no pagination token and no results were returned.
create_thinginsertthing_name, regionCreates a thing record in the registry. If this call is made multiple times using the same thing name and configuration, the call will succeed. If this call is made with the same thing name but different configuration a ResourceAlreadyExistsException is thrown. This is a control plane operation. See Authorization for information about authorizing control plane actions. Requires permission to access the CreateThing action.
register_thinginsertregion, templateBodyProvisions a thing in the device registry. RegisterThing calls other IoT control plane APIs. These calls might exceed your account level IoT Throttling Limits and cause throttle errors. Please contact Amazon Web Services Customer Support to raise your throttling limits if necessary. Requires permission to access the RegisterThing action.
update_thingupdatething_name, regionUpdates the data for a thing. Requires permission to access the UpdateThing action.
delete_thingdeletething_name, regionexpectedVersionDeletes the specified thing. Returns successfully with no error if the deletion is successful or you specify a thing that doesn't exist. Requires permission to access the DeleteThing action.
start_thing_registration_taskexecregion, templateBody, inputFileBucket, inputFileKey, roleArnCreates a bulk thing provisioning task. Requires permission to access the StartThingRegistrationTask action.
stop_thing_registration_taskexectask_id, regionCancels a bulk thing provisioning task. Requires permission to access the StopThingRegistrationTask action.

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
regionstringAWS region (default: us-east-1)
task_idstringThe bulk thing provisioning task ID.
thing_namestringThe name of the thing to delete.
attributeNamestringThe attribute name used to search for things.
attributeValuestringThe attribute value used to search for things.
expectedVersioninteger (int64)The expected version of the thing record in the registry. If the version of the record in the registry does not match the expected version specified in the request, the DeleteThing request is rejected with a VersionConflictException.
maxResultsintegerThe maximum number of results to return in this operation.
nextTokenstringTo retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.
thingTypeNamestringThe name of the thing type used to search for things.
usePrefixAttributeValuebooleanWhen true, the action returns the thing resources with attribute values that start with the attributeValue provided. When false, or not present, the action returns only the thing resources with attribute values that match the entire attributeValue provided.

SELECT examples

Gets information about the specified thing. Requires permission to access the DescribeThing action.

SELECT
attributes,
billing_group_name,
default_client_id,
thing_arn,
thing_id,
thing_name,
thing_type_name,
version
FROM aws.iot.things
WHERE thing_name = '{{ thing_name }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a thing record in the registry. If this call is made multiple times using the same thing name and configuration, the call will succeed. If this call is made with the same thing name but different configuration a ResourceAlreadyExistsException is thrown. This is a control plane operation. See Authorization for information about authorizing control plane actions. Requires permission to access the CreateThing action.

INSERT INTO aws.iot.things (
thingTypeName,
attributePayload,
billingGroupName,
thing_name,
region
)
SELECT
'{{ thingTypeName }}',
'{{ attributePayload }}',
'{{ billingGroupName }}',
'{{ thing_name }}',
'{{ region }}'
RETURNING
thing_arn,
thing_id,
thing_name
;

UPDATE examples

Updates the data for a thing. Requires permission to access the UpdateThing action.

UPDATE aws.iot.things
SET
thingTypeName = '{{ thingTypeName }}',
attributePayload = '{{ attributePayload }}',
expectedVersion = {{ expectedVersion }},
removeThingType = {{ removeThingType }}
WHERE
thing_name = '{{ thing_name }}' --required
AND region = '{{ region }}' --required;

DELETE examples

Deletes the specified thing. Returns successfully with no error if the deletion is successful or you specify a thing that doesn't exist. Requires permission to access the DeleteThing action.

DELETE FROM aws.iot.things
WHERE thing_name = '{{ thing_name }}' --required
AND region = '{{ region }}' --required
AND expectedVersion = '{{ expectedVersion }}'
;

Lifecycle Methods

Creates a bulk thing provisioning task. Requires permission to access the StartThingRegistrationTask action.

EXEC aws.iot.things.start_thing_registration_task
@region='{{ region }}' --required
@@json=
'{
"templateBody": "{{ templateBody }}",
"inputFileBucket": "{{ inputFileBucket }}",
"inputFileKey": "{{ inputFileKey }}",
"roleArn": "{{ roleArn }}"
}'
;