Copyright ©

Mongoose OS Forum

ATTENTION! This forum has moved to:

Do not post any new messages.

Build with WiFi credentials and AWS configurations

How do I go about setting up the build to include the WiFi configuration and the settings from AWS-IOT-Setup? Every time I rebuild and flash, I have to do the wifi setup and aws-iot-setup all over again, and the aws-iot-setup keeps making new certificates.

I'm running into a problem with the demo.js project where if I mess up init.js (syntax/logic error, whatever), mos put init.js, mos call Sys.Reboot, the ESP8266 goes into an endless reboot and I also noticed that a file conf9.json is gone, and in that file was the info for wifi and aws.

I'm getting tired of having to re-provision aws certificates and cleaning up my aws with all the old certificates. Any help on configuring the mos.yml or whatever so that I can reuse the aws certificates will be greatly appreciated.

Thank you.


  • I'd like to be able to avoid having to re-provision WiFi and AWS each time too. Can't the certificates be uploaded as part of the flashing, rather than having to load them separately?

    My application does some intensive work at startup, and when this happens the AWS certificate often fails to upload. I'm guessing the work is stealing time from the stub which is receiving the certificate. Deferring the work with a timer to run slightly after startup then fixes the problem, but that's not a very nice solution.

  • SergeySergey Dublin, Ireland
    1. provision the device.
    2. Save config. copy the conf9.json, the key file and the cert somewhere.
      mos get conf9.json > tmp/conf9.json
        mos get KEYFILE > tmp/KEYFILE
        mos get CERTFILE > tmp/CERTFILE
    3. Restore the config
      mos put tmp/KEYFILE
        mos put tmp/CERTFILE
        mos put tmp/conf9.json
    4. mos call Sys.Reboot

    Note: if you OTA the device instead of reflashing it, you'll keep the config without save/restore dance.
    mos --port ws://IP_ADDR/rpc ota

    Thanked by 2dwtowner Hc95
Sign In or Register to comment.