Monday, 06 July 2020
  1 Replies
  2.1K Visits
Hi there!

I'm trying to connect to my AWS IoT but always getting disconnect after trying to connect

//AWS_Client1: TsgcIoTAmazon_MQTT_Client; // Using component from pallete

AWS_Client1.Amazon.Endpoint := '';
AWS_Client1.Amazon.ClientId := 'sgcWebSockets';
AWS_Client1.Amazon.Port:= 8883;
AWS_Client1.Certificate.KeyFile := 'C:\7db46775ee-private.pem.key';
AWS_Client1.Active := True;

This is my code... Sure all certificates are valid.

Any ideas??
3 years ago

Most probably you can connect because you are not authorized. When you connect using port 8883 and use TCP as transport (which is the default), amazon takes "AWS IoT Core policy" to provide or not authorization to clients and subscriptions. Most probably you must authorize your client id.

Enter in your Amazon AWS console, go to IoT Core and access menu "Secure/Policies", there select the policy attached to your IoT Thing and check at the end how connection is configured. Example:

"Effect": "Allow",
"Action": [
"Resource": [

This configuration means that only clients with ID: sdk-java, basicPubSub and sdk-nodejs-* will be allowed to connect. Change accordingly and try again.
If still doesn't work, enable log and check in cloudwatch the reason why you can't connect.

Kind Regards,
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf
· Insert · Remove
  Upload Files (Maximum 10MB)