This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Connecting to AWS IoT through MQTT

Hello guys,

I have nRF9160DK board here with me and the nRF Connect SDK v1.3.0 environment installed. I want to connect to AWS IoT Thing through the MQTT connection.

I used cloud_client example and your documentation from here as a starting point. My AWS IoT device is properly created on the AWS account and certificates are downloaded into nRF0160DK. In addition to that, here is how I modified my prj.conf and Kconfig files of the cloud_client example.

prj.conf:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Copyright (c) 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#
# General config
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_RESET_ON_FATAL_ERROR=n
CONFIG_NCS_SAMPLES_DEFAULTS=y
# Log level
# For more verbose and detailed log output, set the log level to
# CONFIG_CLOUD_CLIENT_LOG_LEVEL_DBG=y instead.
CONFIG_CLOUD_CLIENT_LOG_LEVEL_INF=y
# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Kconfig:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Copyright (c) 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#
menu "Cloud Client Sample Settings"
config CLOUD_BACKEND
string "String that selects the cloud backend to be used"
default "AWS_IOT"
config AWS_IOT_BROKER_HOST_NAME
string "AWS IoT MQTT broker hostname"
default "xxxxxxxxxx.amazonaws.com"
help
Default is set to be the nRF Cloud MQTT broker.
config AWS_IOT_CLIENT_ID_STATIC
string "Client ID"
default "nrf-IMEI"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

However, when I try to connect to the cloud I get the following error messages:

Fullscreen
1
2
E: mqtt_connect, error: -116
E: Failed to connect to cloud, error: -10
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Is there anything I am missing here?

An interesting thing is that a few months ago, with ncs v1.1.0 or v1.2.0 I was able to connect to the AWS IoT Cloud by using the same approach (see this thread).

Thanks in advance for your time and efforts.

Sincerely,

Bojan.