AWS IoT Core Integration - How to get device shadow on a device


I am trying out the AWS IoT Core Integration.
I am excited about the device configuration using device shadows, which is a very interesting feature.

After following the tutorial and approving the device, I have confirmed that mender-configure deploys the following contents to the configuration file (/var/lib/mender-configure/device-config.json).

  • awsCertificate
  • awsEndpoint
  • awsPrivateKey (not available as is, see this article)

To retrieve the device shadow with curl, run the following command.

curl \
  --tlsv1.2 \
  -X GET \
  --cert <awsCertificate> \
  --key <awsPrivateKey> \


However, I cannot get the device shadow because there is no thingName in device-config.json.

Apparently, the thingName is the same as the Device ID used inside the Mender server.
Can anyone tell me how to get the thingName (Device ID) from the device?

I do not want to have Mender credentials on my device, so I wish there was a way to avoid using Mender’s server-side API.



I ended up with the same issue. If you have the openssl tools available, you can extract the thingname directly from the certificate. It’s embedded in the “subject”. You can try this something like this:

openssl x509 -in cert.crt -subject -noout

You should get an output similar to this:

subject=C = , ST = , L = , O = , OU = , CN = e74d3774-ceff-493c-b3f9-398d4e9d7585

Your thingname can be extracted from the CN field.

1 Like


Thank you for your response.

I was able to get the device shadow on the device with the obtained thingname.