MQTT-bridge-mosquitto not working with AWS Iot

Hi,

   we have implemented https://github.com/nRFCloud/MQTT-bridge-mosquitto in our AWS account. but in we are getting error like 

1736241683: Client nrfcloud-bridge-local closed its connection.
MqttBridgeContainer
1736241683: Connecting bridge nrfcloud-bridge (mqtt.nrfcloud.com:8883)
MqttBridgeContainer
1736241652: Client nrfcloud-bridge-local closed its connection.
MqttBridgeContainer
1736241652: Connecting bridge nrfcloud-bridge (mqtt.nrfcloud.com:8883)
MqttBridgeContainer
1736241621: Client nrfcloud-bridge-local closed its connection.
MqttBridgeContainer
1736241621: Connecting bridge nrfcloud-bridge (mqtt.nrfcloud.com:8883)

   CloudFormation stack is successfully deployed. there is no error in that.

   Also it was working fine around 24 hours ago. suddenly we were not getting any data in AWS so we tried to redeploy it but the result is the same.

Thanks,  

Parents Reply Children
  • Hi,

    I have reported this problem internally. I will get back to you by the end of next week.
    In the meantime, please let me know if situation changes and you start getting data in AWS.

    Best regards,
    Dejan

  • It would be nice to get some feedback on this cause this is stopping everything.

  • Hi,

    I have reached out again to the relevant team internally. I will get back to you with status update by the end of this week.

    Best regards,
    Dejan

  • Hi,
    Is there any update here? We are in a bit hurry as production system is impaired by this.
    Thanks in advance.

    Regards,
    Neel

  • Hi Neel,

    Although there is no fix for MQTT Bridge yet, we have verified that mosquitto MQTT broker (which the bridge uses) works if it is installed and configured manually.

    Fortunately, there is a workaround implementation which you can try to follow. It installs and configures Mosquitto locally on a Windows 11 machine. You can adapt these instructions for use on Linux or in Docker containers as you see fit.

    The MQTT Bridge must be already installed, because it reuses local certs the bridge creates. The ECS task of the bridge does need to be running. You can stop it using the AWS Console by clicking “Update Service” on the ECS cluster’s nrfcloud-mqtt-bridge-MqttBridgeService…, and setting the “Desired tasks” to 0.

    1. In your AWS account and region where the MQTT Bridge is installed, go to the Systems Manager Parameter Store console.

    1. Copy the certificates in the IotCert and IotKey parameters into files named local_IotCert.txt and local_IotKey.txt. Ensure the last line of each file has an end-of-line character at the end.

    1. Using the REST API, create an MQTT Team device. See https://api.nrfcloud.com/v1#tag/Mqtt-Team-Devices/operation/CreateMqttTeamDevice.

    1. Store the 3 certificates returned in files named nrfcloud_caCert.crt, nrfcloud_clientCert.txt, and nrfcloud_privateKey.txt.

    1. Change all literal strings "\n" to end-of-line characters in all 3 files. Ensure the last line of each file has an end-of-line character at the end.

    1. Download https://mosquitto.org/files/binary/win64/mosquitto-2.0.11-install-windows-x64.exe

    1. Install it to the default location

    1. Add "%ProgramFiles%\Mosquitto" (without quotes) to the Windows PATH

    1. Create a directory from where you will run Mosquitto and store configuration files, such as "C:\Mosquitto".

    2. Open a Command Prompt window and "cd" to the run directory you created.

    3. Enter "mosquitto -h". You should see the help page and "mosquitto version 2.0.11" displayed.

    4. Copy the attached "config.txt" into that directory.

    5. Replace the "remote_clientid" with the ID of the MQTT Team device you created, e.g. "mqtt-team-…".

    6. Replace the "address" of the "connection iot-bridge" (not the "connection nrfcloud-bridge") with the AWS IoT Domain configuration name for your AWS account and region.

    7. Create a subdirectory "config".

    8. Copy the 5 files you created above, into that "config" directory. (local_IotCert.txt, local_IotKey.txt, nrfcloud_ca.crt, nrfcloud_clientCert.txt, nrfcloud_privateKey.txt)

    9. In the run directory, start the mosquitto broker with the command: "mosquitto -v -c config.txt".

    10. Verify that MQTT messages sent by devices in your nrfCloud team appear on your AWS account and region on the MQTT topics "data/#" as described in republished topics.


    Please find uploaded example of config.txt file.  

    connection nrfcloud-bridge
    address mqtt.nrfcloud.com:8883
    local_clientid nrfcloud-bridge-local
    # Replace the example below with the device ID of an MQTT Team device you create
    remote_clientid mqtt-team-73a78bf2-6159-4692-87b3-6ae194cb9778-0619ece8-0463-446b-a583-54b7105212df
    bridge_protocol_version mqttv311
    bridge_cafile config/nrfcloud_caCert.txt
    bridge_certfile config/nrfcloud_clientCert.txt
    bridge_keyfile config/nrfcloud_privateKey.txt
    bridge_insecure false
    cleansession true
    start_type automatic
    notifications false
    log_type all
    log_timestamp true
    
    topic m/# in 1 data/ prod/(team-ID)/
    
    connection iot-bridge
    # Replace the example below with your AWS IoT Domain configuration name
    address a3shl1aeabcdef-ats.iot.us-west-1.amazonaws.com:8883
    bridge_cafile config/nrfcloud_caCert.txt
    bridge_certfile config/local_IotCert.txt
    bridge_keyfile config/local_IotKey.txt
    bridge_insecure false
    cleansession true
    start_type automatic
    notifications false
    log_type all
    log_timestamp true
    
    topic # out 1
    

    Best regards,
    Dejan

Related