# Unable to connect to AWS IOT endpoint through Amazon FreeRTOS

**URL:** <https://forums.freertos.org/t/unable-to-connect-to-aws-iot-endpoint-through-amazon-freertos/8856>\
**Category:** AWS\
**Created:** [June 18, 2018, 2:25am UTC](https://forums.freertos.org/t/unable-to-connect-to-aws-iot-endpoint-through-amazon-freertos/8856 "2018-06-18T02:25:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 18, 2018, 2:25am UTC](https://forums.freertos.org/t/unable-to-connect-to-aws-iot-endpoint-through-amazon-freertos/8856/1 "2018-06-18T02:25:07Z")

</div>

**[unnamazon](https://forums.aws.amazon.com/profile.jspa?userID=456422)** 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](http://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](http://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](http://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

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 20, 2018, 12:41am UTC](https://forums.freertos.org/t/unable-to-connect-to-aws-iot-endpoint-through-amazon-freertos/8856/2 "2018-06-20T00:41:01Z")

</div>

**[Alexa-AWS](https://forums.aws.amazon.com/profile.jspa?userID=437627)** 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

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 22, 2018, 6:31am UTC](https://forums.freertos.org/t/unable-to-connect-to-aws-iot-endpoint-through-amazon-freertos/8856/3 "2018-06-22T06:31:23Z")

</div>

**[unnamazon](https://forums.aws.amazon.com/profile.jspa?userID=456422)** 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.
