# Aws-iot-device-client Integration

**URL:** <https://community.zymbit.com/t/aws-iot-device-client-integration/1673>\
**Category:** ZYMKEY4\
**Tags:** aws-iot\
**Created:** [July 1, 2024, 7:02am UTC](https://community.zymbit.com/t/aws-iot-device-client-integration/1673 "2024-07-01T07:02:16Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![chill](https://avatars.discourse-cdn.com/v4/letter/c/e95f7d/32.png) [@chill](https://community.zymbit.com/u/chill)\
**Post date:** [July 4, 2024, 2:15am UTC](https://community.zymbit.com/t/aws-iot-device-client-integration/1673/10 "2024-07-04T02:15:13Z")

</div>

Hi All,  
Thank you for your help. Problem resolved.  
Here what I have done to make it working:

- follow the tutorial [AWS IoT - TLS Client Certificate Authentication |](https://docs.zymbit.com/tutorials/aws-iot/tls/) to sign a certificate
- With sudo, import the zymkey into pkcs#11 [PKCS#11 Support](https://community.zymbit.com/t/pkcs-11-support/607)
- Delete the code block from line 430 ~ 440, [aws-iot-device-client/source/main.cpp at main · awslabs/aws-iot-device-client · GitHub](https://github.com/awslabs/aws-iot-device-client/blob/main/source/main.cpp)

```auto
#else
    if (config.config.secureElement.enabled)
    {
        LOGM_ERROR(
            TAG,
            "*** %s: Secure Element configuration is enabled but feature is not compiled into binary.",
            DC_FATAL_ERROR);
        deviceClientAbort(
            "Invalid configuration. Secure Element configuration is enabled but feature is not compiled into binary.",
            EXIT_FAILURE);
    }

```

- Compile the binary file of aws-iot-device-client by command below with debian bulleye:

```auto
# Building
git clone https://github.com/awslabs/aws-iot-device-client
cd aws-iot-device-client
mkdir build
cd build
cmake -DEXCLUDE_SECURE_ELEMENT="OFF" ../
cmake --build . --target aws-iot-device-client

```

- Add configuration

```auto
{
    ...
    "secure-element": {
		"enabled": false,
		"pkcs11-lib": "<replace_with_pkcs11_lib_path>",
		"secure-element-pin": "<replace_with_secure_element_pin>",
		"secure-element-key-label": "<replace_with_secure_element_key_label>",
		"secure-element-slot-id": replace_with_secure_element_slot_id_integer,
		"secure-element-token-label": "<replace_with_secure_element_token_label>"
	}
    ...
}

```

- Make sure the endpoint of IoT Core allows TLS 1.2
- Execute the aws-iot-device-client with root permission
- Finally, the console show the log if everything works:

```auto
sign resizing because digest and key lengths (32/64) do not match
2024-07-04T01:57:47.313Z [INFO] {SharedCrtResourceManager.cpp}: MQTT connection established with return code: 0
2024-07-04T01:57:47.313Z [INFO] {SharedCrtResourceManager.cpp}: Shared MQTT connection is ready!
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Config shadow is disabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Jobs is disabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Secure Tunneling is enabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Device Defender is disabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Sample shadow is disabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Pub Sub is disabled
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Sensor Publish is disabled
2024-07-04T01:57:47.314Z [INFO] {SharedCrtResourceManager.cpp}: Starting Device Client features.
2024-07-04T01:57:47.314Z [INFO] {SecureTunnelingFeature.cpp}: Running Secure Tunneling!
2024-07-04T01:57:47.314Z [INFO] {Main.cpp}: Client base has been notified that Secure Tunneling has started

```

---

_[View the full topic](https://community.zymbit.com/t/aws-iot-device-client-integration/1673)._
