Unable to connect to AWS IOT endpoint through Amazon FreeRTOS

unnamazon wrote on June 18, 2018:

I have configured, registered a thing, attached a certificate and a policy to it. Then, using Amazon FreeRTOS or using a MQTT broker client - MQTT.FX, when I try to connect to AWS IOT, I am refused connection from the server. Whereas with openssl (8443) or telnet(443) to the same endpoint address and certificates is working.
I am an IAM user for a certain AWS account and my policies are also attached. I have tried disabling the firewall too. Is this anything to do with certain policies not available for my IAM user?

Log from Amazon freertos:
MQTT echo attempting to connect to XXXXXX.iot.us-east-2.amazonaws.com.
Sending command to MQTT task.
Received message 10000 from queue.
eMQTTConnectRequest
[AT]: AT+CIPDOMAIN=“XXXXXX.iot.us-east-2.amazonaws.com
Can’t get remote IP
[AT]: AT+TLSCLOSE=0
[AT]: AT+TLSCONN=0,“TCP”,“XXXXXX.iot.us-east-2.amazonaws.com”,8883
Resp: AT+TLSCLOSE=0
Socket not init
ERROR
Failed to connect to :8883 at_ret -2
prvSetupConnection About to close socket.
No data to received -1
[AT]: AT+TLSCLOSE=0
Socket closed.

I have also attached the connection profile in MQTT.fx client

Alexa-AWS wrote on June 20, 2018:

Hi,

Does your Amazon FreeRTOS device have an internet connection and is it succeeding in creating a socket and doing a DNS lookup? Does the IP address that your endpoint translates to look valid?

The error messages “Can’t get remote IP” and “Socket not init” make me think that there could be a problem before your credentials or policies come into play.

The AWSIoTFullAccess policy that is shown in your screenshot should give you permission to connect, publish, subscribe, and receive using MQTT, provided that it is attached to the credentials of the thing you are using for the connection.

Best,
Alexa

unnamazon wrote on June 22, 2018:

There was some issue with my handling of AT command response, right from AT+CIPDOMAIN. When that’s sorted out, I am now able to connect to the AWS endpoint. Thank you.