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

**URL:** https://hub.mender.io/t/aws-iot-core-integration-how-to-get-device-shadow-on-a-device/5515
**Category:** General Discussions
**Tags:** aws-iot-core-integration
**Created:** [December 29, 2022, 1:25pm UTC](https://hub.mender.io/t/aws-iot-core-integration-how-to-get-device-shadow-on-a-device/5515 "2022-12-29T13:25:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nomtor0204](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/nomtor0204/32/2355_2.png) [@nomtor0204](https://hub.mender.io/u/nomtor0204)
#### Post date: [December 29, 2022, 1:25pm UTC](https://hub.mender.io/t/aws-iot-core-integration-how-to-get-device-shadow-on-a-device/5515/1 "2022-12-29T13:25:05Z")

</div>

Hello,

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](https://hub.mender.io/t/aws-iot-core-integration-private-key-issues/5395/3))

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

```auto
curl \
  --tlsv1.2 \
  -X GET \
  --cert <awsCertificate> \
  --key <awsPrivateKey> \
  https://<awsEndpoint>:8443/things/<thingName>/shadow

# https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-rest-api.html#API_GetThingShadow

```

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.

Thanks,

---

<div class="post-metadata">

### Author: ![Bjurr](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/bjurr/32/1803_2.png) [@Bjurr](https://hub.mender.io/u/Bjurr)
#### Post date: [January 2, 2023, 4:58pm UTC](https://hub.mender.io/t/aws-iot-core-integration-how-to-get-device-shadow-on-a-device/5515/2 "2023-01-02T16:58:15Z")

</div>

Hi!

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:

```auto
openssl x509 -in cert.crt -subject -noout

```

You should get an output similar to this:

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

```

Your thingname can be extracted from the CN field.

---

<div class="post-metadata">

### Author: ![nomtor0204](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/nomtor0204/32/2355_2.png) [@nomtor0204](https://hub.mender.io/u/nomtor0204)
#### Post date: [January 3, 2023, 1:43am UTC](https://hub.mender.io/t/aws-iot-core-integration-how-to-get-device-shadow-on-a-device/5515/3 "2023-01-03T01:43:41Z")

</div>

@Bjurr

Thank you for your response.

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