I have a Mosquitto Broker running in a Windows EC2 Instance. I can connect to it using MQQTX, MQTT Explorer and MQTT JS library in NodeJS app with following credentials:
Protocol: mqtt
Host: localhost or 127.0.0.1
Port: 1883
Username: as defined in password.txt file
Password: as defined in password.txt file
What I need to do is connect to this broker from outside the EC2 Instance. I have tried adding port 1883 to EC2 instance inbound rules on AWS console and allowing all traffic in outbound rules. I even tried allowing all traffic in inbound rules.
I have also added port 1883 to Windows firewall inbound rules.
When I try to connect to this broker from outside using the Public IP/DNS/name of the EC2 instance, I can see that the request is coming in on port 1883 using Wireshark but it does not get acknowledged and the request times out.
I added 2 users to a password.txt
file, encrypted them using mosquitto_passwd -U password.txt
command. Added allow_anonymous false
and password_file C:\mosquitto\password.txt
in conf file.
I also tried by keeping allow_anonymous false
and password_file C:\mosquitto\password.txt
as commented out in conf file and connecting without username and password but no luck.
I have read the conf file and some articles but can't understand the concept of Listeners in conf file but I have a hunch that this is where the configuring needs to be done. If yes, please tell me how to. Any help would be really great.
Edit:
I installed the windows 64 bit version from here and am running it as a service. I am using the default conf file and only updated it to add allow_anonymous false
and password_file C:\mosquitto\password.txt
. I stopped and started the service after conf file edits.