This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use aws_fota program in nRF9160?

I'm trying to use aws_fota, but it doesn't work. Any help?

I was able to set a job on AWS IoT, but the download job doesn't start. The job status is always "in progress". I logged out and logged in and got the same result.

***** Booting Zephyr OS v1.14.99-ncs2 *****
The MQTT AWS Jobs FOTA Sample
LTE Link Connecting ...
LTE Link Connected!
IPv4 Address 0x4980a023
client_id: nrf-352656100218455
[mqtt_evt_handler:131] MQTT client connected!
[mqtt_evt_handler:196] SUBACK packet id: 2112
[mqtt_evt_handler:186] PUBACK packet id: 62996

I use the same region in AWS IoT and S3

I've already checked this thread.
https://devzone.nordicsemi.com/f/nordic-q-a/52039/aws-fota-sample/210098#210098

Parents Reply Children
  • I'm sorry, the AWS_FOTA is intended to be used against nRF Cloud. The documentation is lacking this information but has been reported. Have a look at the HTML Application Update sample documentation, which also uses the Download Client to download the image.

    As stated in the Limitations section of the AWS_FOTA library
    "Currently, the library only uses HTTP for downloading the firmware. It is, however, possible to have it work with HTTPS - see Download client. These changes need to be applied to FOTA Download to enable downloading firmware through HTTPS."

  • Thank you for reporting. I'm confused.

    Do both of aws_fota and http_application_update require you to use nRF Could?

    And I hope Nordic engineers will make a sample fota program using AWS without nRF Cloud. 

  • Hello, 

    To clear the confusion I have forwarded this question to our NCS team. I will get back to you as soon as possible. 

    Kind regards,
    Øyvind

  • Hi, it's possible to use the AWS FOTA and HTTP application update sample with any server that can respond with the content-range header. To be more precise, it needs to support this formatting of the content-range.

    Content-Range: <unit> <range-start>-<range-end>/<size>

    It is the Download Client library that sets this limitation.  

    AWS S3 buckets do respond with this, but the file has to be accessible for the device. To find out if it is, I recommend turning on CONFIG_LOG=y and CONFIG_DOWNLOAD_CLIENT_LOG_LEVEL_DBG=y to see what the header response is.

    I guess that you get either a 403 forbidden or 301 permanent redirects response in the header.

    If you want to test downloading from an S3 bucket, it is easiest to make the files in the bucket public. This can be done by going to the S3 Console, then go bucket>permissions>block public access and deselect the two options which regard blocking public access through policy. 

    Then you can attach the following policy to your bucket by going to bucket>permissions>bucket policy

    {    "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Principal": "*",
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::<bucket name>/*"
            }
        ]
    }

    Then press save. It should be noted that this makes you file publicly available to anyone who has the link.

    After you have done this the format of your job file should be 

    {
      "operation": "app_fw_update",
      "fwversion": "v1.0.2",
      "size": 64300,
      "location": {
        "protocol": "http:",
        "host": "******.s3-us-west-2.amazonaws.com",
        "path": "20190929_test_update.bin"
       }
    }

    The Download client library now appends the / between host and path. It should also be noted that this will use HTTP to download the file(this is possible with the S3 bucket) in a standard configuration, so no change is needed.

Related