Skip to content

AWS IoT commands do not work when using client ID

0

Hi, I'm using AWS IoT Commands (https://docs.aws.amazon.com/iot/latest/developerguide/iot-remote-command.html), but when using a Client ID as the target device instead of a Thing the commands do not get sent correctly. I'm subscribed to the following topics:

  • $aws/commands/things/+/executions/+/request/json
  • $aws/commands/clients/+/executions/+/request/json

Using the MQTT test client I can correctly see the commands sent to $aws/commands/things/+/executions/+/request/json topic, but in the "clients" topic I see nothing.

Any suggestion? This appears to be a bug with IoT Core.

Thanks

asked 2 years ago267 views

1 Answer
0

Thank you for bringing this issue to our attention. Based on the information provided, it appears that you're experiencing difficulty with AWS IoT Commands when using a Client ID as the target device instead of a Thing name.

First, it's important to note that AWS IoT Core does support using both Thing names and Client IDs as target devices for commands. The ability to use Client IDs is specifically designed for cases where devices haven't been registered as Things in AWS IoT.

However, the behavior you're describing - where commands are visible when using Thing names but not when using Client IDs - is unexpected and doesn't align with the intended functionality of AWS IoT Commands.

To troubleshoot this issue, I would suggest the following steps:

  1. Double-check that you're using the correct Client ID when sending the command. The Client ID used must match exactly with the MQTT client ID of your device.

  2. Verify that your device is successfully connected to AWS IoT Core using the Client ID you're targeting.

  3. Ensure that the IAM policies and AWS IoT policies associated with your device or user have the necessary permissions to receive commands using Client IDs.

  4. Check if there are any error messages or logs in the AWS IoT console or CloudWatch that might provide more information about why the commands aren't being delivered when using Client IDs.

  5. Try using the AWS CLI or SDK to send commands and see if you get any error messages that aren't visible in the MQTT test client.

  6. Based on the guide provided: "If your device hasn't been registered as a thing with AWS IoT, you can use the client ID instead. The client ID is a unique identifier that you assign to your device or client. The client ID is defined in the MQTT protocol, and it can contain alphanumeric characters, underscores, or dashes. It must be unique to each device that connects to AWS IoT." Make sure to follow the format: "$aws/commands/<devices>/<DeviceID>/executions/+/request/<PayloadFormat>"

Sources
Commands concepts and status - AWS IoT Core
AWS IoT Device Management commands - AWS IoT Core

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.