{"id":22911,"date":"2021-08-07T11:20:34","date_gmt":"2021-08-07T02:20:34","guid":{"rendered":"https:\/\/www.souichi.club\/?p=22911"},"modified":"2022-03-19T17:22:24","modified_gmt":"2022-03-19T08:22:24","slug":"amazon-freertos-ota","status":"publish","type":"post","link":"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/","title":{"rendered":"Tried OTA (Over The Air) firmware update with Amazon FreeRTOS"},"content":{"rendered":"<ul class=\"bogo-language-switcher list-view\"><li class=\"en-US en current first\"><span class=\"bogoflags bogoflags-us\"><\/span> <span class=\"bogo-language-name\"><a rel=\"alternate\" hreflang=\"en-US\" href=\"https:\/\/www.souichi.club\/en\/wp-json\/wp\/v2\/posts\/22911\/\" title=\"English\" class=\"current\" aria-current=\"page\">English<\/a><\/span><\/li>\n<li class=\"ja last\"><span class=\"bogoflags bogoflags-jp\"><\/span> <span class=\"bogo-language-name\"><a rel=\"alternate\" hreflang=\"ja\" href=\"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/posts\/22911\/\" title=\"Japanese\">\u65e5\u672c\u8a9e<\/a><\/span><\/li>\n<\/ul>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69e3387741739\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #454e5c;color:#454e5c\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #454e5c;color:#454e5c\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69e3387741739\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#What_is_OTA_Update\" >What is OTA Update?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Overall_configuration_diagram\" >Overall configuration diagram<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Advance_preparation\" >Advance preparation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Preparing_the_initial_firmware\" >Preparing the initial firmware<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Directory_Structure\" >Directory Structure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Create_the_s3_bucket\" >Create the s3 bucket<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Creating_Roles\" >Creating Roles<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Attaching_Policies\" >Attaching Policies<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Adding_IAM_permissions\" >Adding IAM permissions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Adding_permissions_to_Amazon_S3\" >Adding permissions to Amazon S3<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Creating_an_OTA_User\" >Creating an OTA User<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Creating_attaching_a_policy\" >Creating &amp; attaching a policy<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Authentication_during_update\" >Authentication during update<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Create_cert_configtxt\" >Create cert_config.txt<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Creating_a_Private_Key\" >Creating a Private Key<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Creating_a_code_signing_certificate\" >Creating a code signing certificate<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Importing_into_AWS_Certificate_Manager\" >Importing into AWS Certificate Manager<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Allow_access_to_FreeRTOS_code_signing\" >Allow access to FreeRTOS code signing<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Demo_program_for_OTA_Update\" >Demo program for OTA Update<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Copy_the_certificate\" >Copy the certificate<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Converting_a_certificate\" >Converting a certificate<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#CMake\" >CMake<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Build\" >Build<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Flush\" >Flush<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Updating_the_firmware\" >Updating the firmware<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Running_ESP32-DevkitC\" >Running ESP32-DevkitC<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Updating_the_version_file\" >Updating the version file<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Re-Build\" >Re-Build<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-29\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Job_registration_to_AWS\" >Job registration to AWS<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-30\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#OTA_Job_Properties\" >OTA Job Properties<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-31\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#Creating_a_Job\" >Creating a Job<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-32\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#OTA_Update\" >OTA Update<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-33\" href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos-ota\/#The_End\" >The End<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_OTA_Update\"><\/span>What is OTA Update?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>OTA (Over The Air) is a function to update to the latest firmware wirelessly.<\/p>\n\n\n\n<p>In the case of IoT, a large number of terminals may be placed here and there, and it would be very inefficient if a person had to go around each terminal to update the program when replacing it.<\/p>\n\n\n\n<p>For this reason, some OS for the IoT have an OTA Update function built in.<br>It is also necessary to have a mechanism to verify that the data received is correct in order to safely deliver the update data and prevent malicious programs from being executed.<\/p>\n\n\n\n<p>Amazon FreeRTOS OTA Update uses a private key and code signing certificate to authenticate the connection, thus ensuring a secure connection.<\/p>\n\n\n\n<p>Also, since it uses the MQTT (Message Queuing Telemetry Transport) protocol over TLS (Transport Layer Security), it uses TLS device authentication to make sure that the destination device is not a fake.<\/p>\n\n\n\n<p>In the <a href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos\/\" target=\"_blank\" rel=\"noreferrer noopener\">previous article<\/a>, I installed Amazon FreeRTOS on ESP-32 DevKitC and ran a sample program that sends messages to AWS IoT Core.<\/p>\n\n\n\n<p>For details, please refer to the previous article, but I added the &#8220;OTA Updates&#8221; library when I selected the demo project.<\/p>\n\n\n\n<p>Adding this library makes it relatively easy to implement OTA Update.<\/p>\n\n\n\n<p>Translated with www.DeepL.com\/Translator (free version)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Overall_configuration_diagram\"><\/span>Overall configuration diagram<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-01.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-01.png?resize=768%2C432&#038;ssl=1\" alt=\"Overall structure of OTA Update for Amazon FreeRTOS\" class=\"wp-image-22918\" width=\"768\" height=\"432\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-01.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-01.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-01.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-01.png?resize=1536%2C864&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-01.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>The OTA Update mechanism of Amazon FreeRTOS is as follows.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Create a private key and code-signing certificate in advance and register them with AWS Certificate Manager.<\/li><li>Save the modified updated firmware compiled on PC to a disk (s3) in the AWS cloud.<\/li><li>From the AWS console, specify the target device (or group) and create a job.<\/li><li>OTA Update agent running on ESP32 will download the latest module from s3 via MQTT protocol and replace the firmware.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Advance_preparation\"><\/span>Advance preparation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The AWS CLI (Command Line Interface) is required to import the code-signing certificate into AWS Certificate Manager, so install it <a href=\"https:\/\/aws.amazon.com\/cli\/?nc1=h_ls\" target=\"_blank\" rel=\"noreferrer noopener\">from this page<\/a> in advance.<\/p>\n\n\n\n<p>I downloaded 64-bit Windows installer.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-02.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-02.png?resize=768%2C376&#038;ssl=1\" alt=\"Installing the AWS CLI\" class=\"wp-image-22919\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-02.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-02.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-02.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-02.png?resize=1536%2C751&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-02.png?w=1857&amp;ssl=1 1857w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Preparing_the_initial_firmware\"><\/span>Preparing the initial firmware<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Prepare an ESP32 DevkitC running a pre-update version of the firmware with a certificate for signature verification and the OTA Update agent.<\/p>\n\n\n\n<p>The general steps are as follows.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Create an s3 bucket<\/li><li>Create roles and policies<\/li><li>Create a user and attach a policy<\/li><li>Create a private key<\/li><li>Create a code signing certificate<\/li><li>Import into AWS Certificate Manager<\/li><li>Grant access to FreeRTOS code signing<\/li><li>Convert and copy certificates<\/li><li>Compile &amp; Flush (Write)<\/li><\/ol>\n\n\n\n<p>It is assumed that the steps <a href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos\/\" target=\"_blank\" rel=\"noreferrer noopener\">in this article<\/a> have been completed in advance, including downloading FreeRTOS from the AWS console, building the ESP-IDF environment on a PC, and building the CMake environment.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Directory_Structure\"><\/span>Directory Structure<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Following the steps in the previous article, I downloaded Amazon FreeRTOS to PC (Windows 10) and extracted it to the following directory.<\/p>\n\n\n\n<p>I unzipped it to D:\\GoogleDrive\\M2B\\FreeRTOS, but you can use any directory you like.<\/p>\n\n\n<pre><code class=\"lang-shell\">\u251c\u2500d:\n\u2502  \u2502      \n\u2502  \u251c\u2500GoogleDriveD\n\u2502  \u2502  \u2502\n\u2502  \u2502  \u251c\u2500\u2500M2B\n\u2502  \u2502  \u2502  \u2502\n\u2502  \u2502  \u2502  \u251c\u2500\u2500build\u3000\u30fb\u30fb\u30fb\u3000For storing build files\n\u2502  \u2502  \u2502  \u2502\n\u2502  \u2502  \u2502  \u251c\u2500\u2500FreeRTOS \u30fb\u30fb\u30fb Unzip it here.\n\u2502  \u2502  \u2502  \u2502  \u2502\n\u2502  \u2502  \u2502  \u2502  \u251c\u2500\u2500demos\u3000\u30fb\u30fb\u30fbDemo Application\n\u2502  \u2502  \u2502  \u2502  \u2502\n\u2502  \u2502  \u2502  \u2502  \u251c\u2500\u2500device\n\u2502  \u2502  \u2502  \u2502  \u2502\n\u2502  \u2502  \u2502  \u2502  \u251c\u2500\u2500freertos_kernel\u3000\u30fb\u30fb\u30fb FreeRTOS kernel\n\u2502  \u2502  \u2502  \u2502  \u2502\n\u2502  \u2502  \u2502  \u2502  \u251c\u2500\u2500libraries\n\u2502  \u2502  \u2502  \u2502  \u2502\n\u2502  \u2502  \u2502  \u2502  \u251c\u2500\u2500tests\n\u2502  \u2502  \u2502  \u2502  \u2502\n\u2502  \u2502  \u2502  \u2502  \u251c\u2500\u2500tools\u3000\u30fb\u30fb\u30fb\u3000Conversion tools for authentication files, etc.\n\u2502  \u2502  \u2502  \u2502  \u2502\n\u2502  \u2502  \u2502  \u2502  \u251c\u2500\u2500vendors\u3000\u30fb\u30fb\u30fb ESP-IDF\n\u2502  \u2502  \u2502  \u2502  \u2502<\/code><\/pre>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Create_the_s3_bucket\"><\/span>Create the s3 bucket<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Create an area on AWS s3 to store the updated firmware.<\/p>\n\n\n\n<p>From the AWS console, go to the s3 service and click the &#8220;Create Bucket&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-03.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-03.png?resize=768%2C377&#038;ssl=1\" alt=\"Creating an s3 bucket in AWS\" class=\"wp-image-23019\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-03.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-03.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-03.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-03.png?resize=1536%2C755&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-03.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Bucket name: esp-wroom-32-ota-en<\/li><li>AWS Region: US East(N. Virginia)us-east-1<\/li><\/ul>\n\n\n\n<p>and scroll down to the bottom.<\/p>\n\n\n\n<p>The bucket name needs to be unique around the world.<\/p>\n\n\n\n<p>If you run into the same name, add the date, etc. to make it a unique bucket name.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-04.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-04.png?resize=768%2C375&#038;ssl=1\" alt=\"Set the bucket name and region.\" class=\"wp-image-23021\" width=\"768\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-04.png?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-04.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-04.png?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-04.png?resize=1536%2C750&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-04.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Check &#8220;Block all public access&#8221; and scroll down.<\/p>\n\n\n\n<p>Create a separate policy and use that policy for access.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-05.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-05.png?resize=768%2C377&#038;ssl=1\" alt=\"Block all public access\" class=\"wp-image-23024\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-05.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-05.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-05.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-05.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-05.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Bucket versioning: Enable<\/li><\/ul>\n\n\n\n<p>Scroll down.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-06.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-06.png?resize=768%2C375&#038;ssl=1\" alt=\"Enable bucket versioning.\" class=\"wp-image-23025\" width=\"768\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-06.png?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-06.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-06.png?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-06.png?resize=1536%2C750&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-06.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Tags are not set (you may set them if necessary).<\/li><li>Default encryption is disabled<\/li><\/ul>\n\n\n\n<p>Click on the &#8220;Create bucket&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-07.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-07.png?resize=768%2C376&#038;ssl=1\" alt=\"Creating a bucket\" class=\"wp-image-23026\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-07.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-07.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-07.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-07.png?resize=1536%2C752&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-07.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>The bucket has been created.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-08.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-08.png?resize=768%2C377&#038;ssl=1\" alt=\"The bucket has been created.\" class=\"wp-image-23027\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-08.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-08.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-08.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-08.png?resize=1536%2C755&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-08.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_Roles\"><\/span>Creating Roles<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The next step is to create a role that will be used for the OTA Update job.<\/p>\n\n\n\n<p>This role will be used to update the firmware, so it will need access to Amazon FreeRTOS Update, IAM, and s3.<\/p>\n\n\n\n<p>From the AWS console, go to the IAM service page and select the Roles.<\/p>\n\n\n\n<p>Click the &#8220;Create role&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-10.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-10.png?resize=768%2C376&#038;ssl=1\" alt=\"Create role\" class=\"wp-image-23031\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-10.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-10.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-10.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-10.png?resize=1536%2C752&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-10.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Select type trusted entity: AWS Service<\/li><\/ul>\n\n\n\n<p>and scroll down.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-11.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-11.png?resize=768%2C377&#038;ssl=1\" alt=\"Select type trusted entity: AWS service\" class=\"wp-image-23034\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-11.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-11.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-11.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-11.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-11.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Select IoT from the list of AWS services.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-12.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-12.png?resize=768%2C377&#038;ssl=1\" alt=\"Select IoT from the list of AWS services.\" class=\"wp-image-23035\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-12.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-12.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-12.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-12.png?resize=1536%2C755&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-12.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Select IoT from the list of use cases below, and click on the &#8220;Next Permissions&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-13.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-13.png?resize=768%2C377&#038;ssl=1\" alt=\"Select IoT as the next step\" class=\"wp-image-23036\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-13.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-13.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-13.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-13.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-13.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>The following policies are attached by default to the IoT selection.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>AWSIoTLogging<\/li><li>AWSIoTRuleActions<\/li><li>AWSIoTThingsRegistration<\/li><\/ul>\n\n\n\n<p>Click on the &#8220;Next Tags&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-14.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-14.png?resize=768%2C379&#038;ssl=1\" alt=\"Next:Tags\" class=\"wp-image-23037\" width=\"768\" height=\"379\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-14.png?resize=1024%2C505&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-14.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-14.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-14.png?resize=1536%2C757&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-14.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Click the &#8220;Next Review&#8221; button without setting any tags (you can set them if you want).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-15.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-15.png?resize=768%2C377&#038;ssl=1\" alt=\"No tags are set.\" class=\"wp-image-23038\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-15.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-15.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-15.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-15.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-15.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Role name: esp-32-ota-role-en<\/li><li>Description: Allows IoT to call AWS services on your behalf.<\/li><\/ul>\n\n\n\n<p>and click the &#8220;Create role&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-16.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-16.png?resize=768%2C375&#038;ssl=1\" alt=\"Creating Roles\" class=\"wp-image-23039\" width=\"768\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-16.png?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-16.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-16.png?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-16.png?resize=1536%2C750&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-16.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>A role was created.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-17.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-17.png?resize=768%2C375&#038;ssl=1\" alt=\"A role was created.\" class=\"wp-image-23042\" width=\"768\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-17.png?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-17.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-17.png?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-17.png?resize=1536%2C750&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-17.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Attaching_Policies\"><\/span>Attaching Policies<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Attaching a few policies.<\/p>\n\n\n\n<p>Attach the AmazonFreeRTOSOTAUpdate policy to the role<\/p>\n\n\n\n<p>Select the role esp-32-ota-role-en just created.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-18.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-18.png?resize=768%2C377&#038;ssl=1\" alt=\"Select the esp-32-ota-role\" class=\"wp-image-23043\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-18.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-18.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-18.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-18.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-18.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Click on the &#8220;Attach policies&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-19.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-19.png?resize=768%2C361&#038;ssl=1\" alt=\"Click on the &quot;Attach Policy&quot; button.\" class=\"wp-image-23046\" width=\"768\" height=\"361\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-19.png?resize=1024%2C481&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-19.png?resize=300%2C141&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-19.png?resize=768%2C361&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-19.png?resize=1536%2C722&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-19.png?resize=520%2C245&amp;ssl=1 520w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-19.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Enter &#8220;AmazonFreeRTOSOTAUpdate&#8221; in the Filter policies, search for it, check the policies that appear, and then click the &#8220;Attach policy&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-20.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-20.png?resize=768%2C377&#038;ssl=1\" alt=\"Attaching AmazonFreeRTOSOTAUpdate policy\" class=\"wp-image-23047\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-20.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-20.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-20.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-20.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-20.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>AmazonFreeRTOSOTAUpdate policy has been attached.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-21.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-21.png?resize=768%2C377&#038;ssl=1\" alt=\"AmazonFreeRTOSOTAUpdate policy has been attached\" class=\"wp-image-23048\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-21.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-21.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-21.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-21.png?resize=1536%2C755&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-21.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Adding_IAM_permissions\"><\/span>Adding IAM permissions<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Add permissions to IAM.<\/p>\n\n\n\n<p>Click &#8220;+Add inline policy.&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-22.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-22.png?resize=768%2C376&#038;ssl=1\" alt=\"Adding an inline policy\" class=\"wp-image-23049\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-22.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-22.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-22.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-22.png?resize=1536%2C752&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-22.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Click on the JSON tab.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-23.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-23.png?resize=768%2C376&#038;ssl=1\" alt=\"JSON tab\" class=\"wp-image-23050\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-23.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-23.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-23.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-23.png?resize=1536%2C752&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-23.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Paste the policy document below and click the &#8220;Review Policy&#8221; button.<\/p>\n\n\n<pre><code class=\"lang-shell\">{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n      {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"iam:GetRole\",\n                \"iam:PassRole\"\n            ],\n            \"Resource\": \"arn:aws:iam::Your AWS Account ID:role\/esp-32-ota-role-en\"\n      }\n    ]\n}<\/code><\/pre>\n<figure class=\"wp-block-table is-style-regular\">\n<table class=\"r_table01\">\n<tbody>\n<tr>\n<td class=\"r_td30\">\n<p>AWS Account ID<\/p>\n<\/td>\n<td>\n<p>Your AWS Account ID(numeric)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>esp-32-ota-role-en<\/p>\n<\/td>\n<td>\n<p>The role name you just created<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-25.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-25.png?resize=768%2C376&#038;ssl=1\" alt=\"Manually add policy documents\" class=\"wp-image-23054\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-25.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-25.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-25.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-25.png?resize=1536%2C752&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-25.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Name: esp-32-ota-iam-Policy-en<\/li><\/ul>\n\n\n\n<p>Click on the &#8220;Create policy&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-26.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-26.png?resize=768%2C375&#038;ssl=1\" alt=\"Create Policy\" class=\"wp-image-23055\" width=\"768\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-26.png?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-26.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-26.png?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-26.png?resize=1536%2C750&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-26.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>An inline policy has been created and attached.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-27.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-27.png?resize=768%2C379&#038;ssl=1\" alt=\"An inline policy has been created and attached.\" class=\"wp-image-23056\" width=\"768\" height=\"379\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-27.png?resize=1024%2C505&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-27.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-27.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-27.png?resize=1536%2C757&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-27.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Adding_permissions_to_Amazon_S3\"><\/span>Adding permissions to Amazon S3<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Let&#8217;s add more permissions to s3.<\/p>\n\n\n\n<p>Note that if your Amazon S3 bucket name starts with &#8220;afr-ota&#8221;, the &#8220;AmazonFreeRTOSOTAUpdate&#8221; administrative policy that you just attached already contains the necessary permissions, so you don&#8217;t need to do the following.<\/p>\n\n\n\n<p>I have set the s3 bucket name as &#8220;esp-wroom-32-ota-en&#8221;, so I had to add the policy.<\/p>\n\n\n\n<p>Click &#8220;+Add inline policy&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-28.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-28.png?resize=768%2C377&#038;ssl=1\" alt=\"Add Inline Policy&quot;\" class=\"wp-image-23059\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-28.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-28.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-28.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-28.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-28.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Click on the JSON tab.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-29.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-29.png?resize=768%2C374&#038;ssl=1\" alt=\"Click on the JSON tab\" class=\"wp-image-23061\" width=\"768\" height=\"374\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-29.png?resize=1024%2C499&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-29.png?resize=300%2C146&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-29.png?resize=768%2C374&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-29.png?resize=1536%2C749&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-29.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Paste the policy document below and click the &#8220;Review policy&#8221; button.<\/p>\n\n\n<pre><code class=\"lang-shell\">{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"s3:GetObjectVersion\",\n                \"s3:GetObject\",\n                \"s3:PutObject\"\n            ],\n            \"Resource\": [\n                \"arn:aws:s3:::esp-wroom-32-ota-en\/*\"\n            ]\n        }\n    ]\n}<\/code><\/pre>\n<figure class=\"wp-block-table is-style-regular\">\n<table class=\"r_table01\">\n<tbody>\n<tr>\n<td class=\"r_td30\">\n<p>esp-wroom-32-ota-en<\/p>\n<\/td>\n<td>\n<p>s3 bucket name<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-30.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-30.png?resize=768%2C377&#038;ssl=1\" alt=\"Adding an access policy to s3\" class=\"wp-image-23064\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-30.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-30.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-30.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-30.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-30.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Name: esp-32-s3-Policy-en<\/li><\/ul>\n\n\n\n<p>and click the &#8220;Create policy&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-31.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-31.png?resize=768%2C377&#038;ssl=1\" alt=\"Add s3 access policy\" class=\"wp-image-23066\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-31.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-31.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-31.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-31.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-31.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>The policy has been created and attached.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-32.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-32.png?resize=768%2C375&#038;ssl=1\" alt=\"The policy has been created and attached.\" class=\"wp-image-23067\" width=\"768\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-32.png?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-32.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-32.png?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-32.png?resize=1536%2C750&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-32.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_an_OTA_User\"><\/span>Creating an OTA User<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Create an OTA user.<\/p>\n\n\n\n<p>This user will be used to run the OTA update, which will be run from Amazon FreeRTOS on ESP32, and must have the following permissions<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Access the S3 bucket where the firmware update (update) is stored.<\/li><li>Access the certificates stored in AWS Certificate Manager.<\/li><li>Access to AWS IoT MQTT-based file delivery capabilities<\/li><li>Access FreeRTOS OTA Update<\/li><li>Accessing AWS IoT Jobs<\/li><li>Accessing IAM<\/li><li>Accessing Code Signing for AWS IoT<\/li><li>List FreeRTOS hardware platforms<\/li><\/ul>\n\n\n\n<p>From the AWS console, navigate to the IAM service and click the &#8220;Add users&#8221; button in the User menu.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-33.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-33.png?resize=768%2C376&#038;ssl=1\" alt=\"Adding a user with IAM\" class=\"wp-image-23068\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-33.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-33.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-33.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-33.png?resize=1536%2C752&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-33.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>User name: esp32otaupdateen<\/li><li>Programmatic access: Check<\/li><\/ul>\n\n\n\n<p>Click on the &#8220;Next Permissions&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-34.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-34.png?resize=768%2C377&#038;ssl=1\" alt=\"Create the esp32otaupdateen user\" class=\"wp-image-23069\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-34.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-34.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-34.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-34.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-34.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Click the Next Tags button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-35.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-35.png?resize=768%2C377&#038;ssl=1\" alt=\"Next Tags\" class=\"wp-image-23070\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-35.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-35.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-35.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-35.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-35.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Do not add any tags (you may do so), and click the &#8220;Next Review&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-36.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-36.png?resize=768%2C376&#038;ssl=1\" alt=\"Next Review\" class=\"wp-image-23071\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-36.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-36.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-36.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-36.png?resize=1536%2C752&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-36.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>&#8220;This user has no permissions&#8221; A warning message will appear, but click the &#8220;Create user&#8221; button.<\/p>\n\n\n\n<p>The permissions will be added after this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-37.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-37.png?resize=768%2C377&#038;ssl=1\" alt=\"Add User\" class=\"wp-image-23072\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-37.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-37.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-37.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-37.png?resize=1536%2C755&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-37.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>A user will be created and the Access key ID and Secret access key will be saved.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-39.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-39.png?resize=768%2C377&#038;ssl=1\" alt=\"Save the Access key ID and Secret access key\" class=\"wp-image-23074\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-39.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-39.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-39.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-39.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-39.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_attaching_a_policy\"><\/span>Creating &amp; attaching a policy<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Create and attach a policy.<\/p>\n\n\n\n<p>Select esp32otaupdateen from the list of user names<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-40.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-40.png?resize=768%2C359&#038;ssl=1\" alt=\"Select the user you created.\" class=\"wp-image-23075\" width=\"768\" height=\"359\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-40.png?resize=1024%2C479&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-40.png?resize=300%2C140&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-40.png?resize=768%2C359&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-40.png?resize=1536%2C718&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-40.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Click on the &#8220;Add permissions&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-41.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-41.png?resize=768%2C359&#038;ssl=1\" alt=\"Add permissions\" class=\"wp-image-23076\" width=\"768\" height=\"359\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-41.png?resize=1024%2C479&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-41.png?resize=300%2C140&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-41.png?resize=768%2C359&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-41.png?resize=1536%2C718&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-41.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>&#8220;Attach existing policies directly&#8221; &#8211; &gt; Click the &#8220;Create policy&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-42.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-42.png?resize=768%2C377&#038;ssl=1\" alt=\"Create policy\" class=\"wp-image-23077\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-42.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-42.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-42.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-42.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-42.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Select the JSON tab.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-43.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-43.png?resize=768%2C377&#038;ssl=1\" alt=\"JSON tab\" class=\"wp-image-23078\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-43.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-43.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-43.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-43.png?resize=1536%2C755&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-43.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Paste the following policy code and click the &#8220;Next Tags&#8221; button.<\/p>\n\n\n<pre><code class=\"lang-shell\">{\n    \"Version\":\"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"s3:ListBucket\",\n                \"s3:ListAllMyBuckets\",\n                \"s3:CreateBucket\",\n                \"s3:PutBucketVersioning\",\n                \"s3:GetBucketLocation\",\n                \"s3:GetObjectVersion\",\n                \"s3:ListBucketVersions\",\n                \"acm:ImportCertificate\",\n                \"acm:ListCertificates\",\n                \"iot:*\",\n                \"iam:ListRoles\",\n                \"freertos:ListHardwarePlatforms\",\n                \"freertos:DescribeHardwarePlatform\"\n            ],\n            \"Resource\": \"*\"\n        },\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"s3:GetObject\",\n                \"s3:PutObject\"\n            ],\n            \"Resource\": \"arn:aws:s3:::esp-wroom-32-ota-en\/*\"\n        },\n        {   \n            \"Effect\": \"Allow\",\n            \"Action\": \"iam:PassRole\",\n            \"Resource\": \"arn:aws:iam::AWS account ID:role\/esp-32-ota-role-en\"\n        }\n    ]\n}<\/code><\/pre>\n<figure class=\"wp-block-table is-style-regular\">\n<table class=\"r_table01\">\n<tbody>\n<tr>\n<td class=\"r_td30\">\n<p>esp-wroom-32-ota-en<\/p>\n<\/td>\n<td>\n<p>s3 bucket name<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>AWS account ID<\/p>\n<\/td>\n<td>\n<p>your AWS account ID(numeric)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>esp-32-ota-role-en<\/p>\n<\/td>\n<td>\n<p>role name<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-44.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-44.png?resize=768%2C377&#038;ssl=1\" alt=\"Paste the policy into the next step\" class=\"wp-image-23080\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-44.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-44.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-44.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-44.png?resize=1536%2C755&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-44.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Do not add any tags (optional) and click the &#8220;Next Review&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-45.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-45.png?resize=768%2C377&#038;ssl=1\" alt=\"Next Review\" class=\"wp-image-23082\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-45.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-45.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-45.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-45.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-45.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Name: esp32otaupdate-Policy-en<\/li><\/ul>\n\n\n\n<p>Scroll down.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-46.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-46.png?resize=768%2C377&#038;ssl=1\" alt=\"esp32otaupdate-Policy-en\" class=\"wp-image-23085\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-46.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-46.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-46.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-46.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-46.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Click on the &#8220;Create policy&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-47.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-47.png?resize=768%2C374&#038;ssl=1\" alt=\"Create Policy\" class=\"wp-image-23086\" width=\"768\" height=\"374\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-47.png?resize=1024%2C499&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-47.png?resize=300%2C146&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-47.png?resize=768%2C374&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-47.png?resize=1536%2C749&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-47.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Go back to the previous screen and click the refresh icon, then search for the policy name just created &#8220;esp32otaupdate-Policy-en&#8221;, check it when it appears in the list, and click the &#8220;Next Review&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-48.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-48.png?resize=768%2C376&#038;ssl=1\" alt=\"Attach esp32otaupdate-Policy\" class=\"wp-image-23087\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-48.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-48.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-48.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-48.png?resize=1536%2C752&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-48.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Click on the &#8220;Add permissions&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-49.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-49.png?resize=768%2C377&#038;ssl=1\" alt=\"Add permissions\" class=\"wp-image-23088\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-49.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-49.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-49.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-49.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-49.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Added permissions.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-50.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-50.png?resize=768%2C377&#038;ssl=1\" alt=\"add permissions\" class=\"wp-image-23089\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-50.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-50.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-50.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-50.png?resize=1536%2C755&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-50.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Authentication_during_update\"><\/span>Authentication during update<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Here&#8217;s how to do it on a PC (Windows 10).<\/p>\n\n\n\n<p>When downloading the latest firmware from the device (ESP32-DevKitC), I used the private key and code signing certificate to check if the image is correct.<\/p>\n\n\n\n<p>In other words, the code signing certificate is created to prevent the device from mistakenly reflecting the malicious firmware.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Create_cert_configtxt\"><\/span>Create cert_config.txt<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Create a D:\\GoogleDriveD\\M2B\\FreeRTOS\\OTA_Cert\\cert_config.txt file with the following contents using a text editor.<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u5185\u5bb9\u3067  D:\u00a5GoogleDriveD\u00a5M2B\u00a5FreeRTOS\u00a5OTA_Cert\u00a5cert_config.txt \u30d5\u30a1\u30a4\u30eb\u3092\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u4f5c\u6210\u3059\u308b\u3002<\/p>\n\n\n<pre><code class=\"lang-shell\">[ req ]\nprompt             = no\ndistinguished_name = my_dn\n                    \n[ my_dn ]\ncommonName = your mail address\n                    \n[ my_exts ]\nkeyUsage         = digitalSignature\nextendedKeyUsage = codeSigning<\/code><\/pre>\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-48.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-48.png?resize=488%2C272&#038;ssl=1\" alt=\"cert_config.txt file\" class=\"wp-image-22770\" width=\"488\" height=\"272\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-48.png?w=650&amp;ssl=1 650w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-48.png?resize=300%2C168&amp;ssl=1 300w\" sizes=\"auto, (max-width: 488px) 100vw, 488px\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_a_Private_Key\"><\/span>Creating a Private Key<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Create an ECDSA code-signed private key using the OpenSSL command from PowerShell on Windows 10.<\/p>\n\n\n\n<p>Execute it in D:\\GoogleDriveD\\M2B\\FreeRTOS\\OTA_Cert&gt;<\/p>\n\n\n<pre><code class=\"lang-shell\">openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -pkeyopt ec_param_enc:named_curve -outform PEM -out ecdsasigner.key<\/code><\/pre>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-50.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-50.png?resize=768%2C119&#038;ssl=1\" alt=\"ECDSA Code Signing Creating a Private Key\" class=\"wp-image-22777\" width=\"768\" height=\"119\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-50.png?resize=1024%2C158&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-50.png?resize=300%2C46&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-50.png?resize=768%2C119&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-50.png?w=1093&amp;ssl=1 1093w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n<figure class=\"wp-block-table is-style-regular\">\n<table class=\"r_table01\">\n<tbody>\n<tr>\n<td class=\"r_td30\">\n<p>openssl<\/p>\n<\/td>\n<td>\n<p>Run the openssl command from PowerShell on Windows 10<\/p>\n<p>If it is not already installed, install the Win64 OpenSSL version <a href=\"https:\/\/slproweb.com\/products\/Win32OpenSSL.html\" target=\"_blank\" rel=\"noopener\">from this page<\/a> (msi is the installer version).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>genpkey<\/p>\n<\/td>\n<td>\n<p>Generating a private key<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-algorithm<\/p>\n<\/td>\n<td>\n<p>The public key algorithm used by RSA, DSA, DH, and others.<\/p>\n<p>RSA, RSA-PSS, EC, X25519, X448, ED25519, and ED448 can be specified.<\/p>\n<p>EC (Elliptic Curve): Elliptic curve algorithm is specified.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-pkeyopt<\/p>\n<\/td>\n<td>\n<p>ec_paramgen_curve:P-256 is specified.<\/p>\n<p>P-256 curve is specified in the parameter of elliptic curve algorithm.<\/p>\n<p>p = 2<sup>256<\/sup> \u2013 2<sup>224<\/sup> + 2<sup>192<\/sup> + 2<sup>96<\/sup> &#8211; 1<\/p>\n<p>which is represented by the equation<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-pkeyopt<\/p>\n<\/td>\n<td>\n<p>ec_param_enc:named_curve is specified.<\/p>\n<p>named_curve, explicit can be specified.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-outform<\/p>\n<\/td>\n<td>\n<p>Output format<\/p>\n<p>PEM, DER can be specified.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-out<\/p>\n<\/td>\n<td>\n<p>Specify the output file name for the private key.<\/p>\n<p>I specified &#8220;ecdsasigner.key&#8221;.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_a_code_signing_certificate\"><\/span>Creating a code signing certificate<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Based on the private key (ecsdsasigner.key) that I created earlier, I created a code signing certificate (ecsdsasigner.crt) for ECDSA using the following command.<\/p>\n\n\n<pre><code class=\"lang-shell\">openssl req -new -x509 -config cert_config.txt -extensions my_exts -nodes -days 365 -key ecdsasigner.key -out ecdsasigner.crt<\/code><\/pre>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-51.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-51.png?resize=768%2C278&#038;ssl=1\" alt=\"Creating a code signing certificate\" class=\"wp-image-22778\" width=\"768\" height=\"278\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-51.png?resize=1024%2C371&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-51.png?resize=300%2C109&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-51.png?resize=768%2C278&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-51.png?w=1097&amp;ssl=1 1097w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Importing_into_AWS_Certificate_Manager\"><\/span>Importing into AWS Certificate Manager<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Import the code signing certificate, private key, and certificate chain into AWS Certificate Manager using AWS CLI.<\/p>\n\n\n\n<p>In advance, I used the aws configure command to set the access key ID, secret access key, region, etc. for the OTA user (esp32otaupdateen) that I just created.<\/p>\n\n\n\n<p>Note that once the aws configure command is configured, the previous settings are saved even if the computer is rebooted.<\/p>\n\n\n<pre><code class=\"lang-shell\">aws configure<\/code><\/pre>\n\n\n<ul class=\"wp-block-list\"><li>AWS Access Key ID [None]: Specify the access key ID when creating a user<\/li><li>AWS Secret Access Key [None]: Specify the secret access key when creating a user<\/li><li>Default region name [None]: us-east-1<\/li><li>Default output format [None]: json<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-51.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-51.png?resize=635%2C164&#038;ssl=1\" alt=\"Setting up the environment with AWS configure\" class=\"wp-image-23105\" width=\"635\" height=\"164\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-51.png?w=847&amp;ssl=1 847w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-51.png?resize=300%2C77&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-51.png?resize=768%2C198&amp;ssl=1 768w\" sizes=\"auto, (max-width: 635px) 100vw, 635px\" \/><\/a><\/figure>\n\n\n\n<p>Then import the signing certificate, private key, etc. into AWS Certificate Manager using the following command, and save the certificate&#8217;s ARN (Amazon Resource Name) as it is returned.<\/p>\n\n\n<pre><code class=\"lang-shell\">aws acm import-certificate --certificate fileb:\/\/ecdsasigner.crt --private-key fileb:\/\/ecdsasigner.key<\/code><\/pre>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-52.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-52.png?resize=768%2C103&#038;ssl=1\" alt=\"Importing certificates and other information into the ACM\" class=\"wp-image-23107\" width=\"768\" height=\"103\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-52.png?resize=1024%2C137&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-52.png?resize=300%2C40&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-52.png?resize=768%2C102&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-52.png?w=1094&amp;ssl=1 1094w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n<figure class=\"wp-block-table is-style-regular\">\n<table class=\"r_table01\">\n<tbody>\n<tr>\n<td class=\"r_td30\">\n<p>acm<\/p>\n<\/td>\n<td>\n<p>Importing certificates with acm (AWS Certificate Manager).<\/p>\n<p>I specified import-certificate.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>&#8211;certificate<\/p>\n<\/td>\n<td>\n<p>Code signing certificate<\/p>\n<p>fileb:\/\/ecdsasigner.crt was specified.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>&#8211;private-key<\/p>\n<\/td>\n<td>\n<p>Private Key<\/p>\n<p>fileb:\/\/ecdsasigner.key was specified.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Allow_access_to_FreeRTOS_code_signing\"><\/span>Allow access to FreeRTOS code signing<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>When updating firmware, digital signatures are used to check the authenticity of the update data.<\/p>\n\n\n\n<p>In order to do this, the account for the update (esp32otaupdateen) must be allowed access to FreeRTOS code signing (Code Sigining for AWS IoT).<\/p>\n\n\n\n<p>Select esp32otaupdateen from the IAM user in the AWS console.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-53.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-53.png?resize=768%2C362&#038;ssl=1\" alt=\"Select esp32otaupdateen.\" class=\"wp-image-23110\" width=\"768\" height=\"362\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-53.png?resize=1024%2C482&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-53.png?resize=300%2C141&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-53.png?resize=768%2C362&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-53.png?resize=1536%2C723&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-53.png?resize=520%2C245&amp;ssl=1 520w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-53.png?resize=720%2C340&amp;ssl=1 720w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-53.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Click on the &#8220;Add permissions&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-54.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-54.png?resize=768%2C375&#038;ssl=1\" alt=\"Click the Add permissions\" class=\"wp-image-23112\" width=\"768\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-54.png?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-54.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-54.png?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-54.png?resize=1536%2C750&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-54.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>&#8220;Attach existing policies directly&#8221; -&gt; Click the &#8220;Create policy&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-55.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-55.png?resize=768%2C377&#038;ssl=1\" alt=\"Create policy\" class=\"wp-image-23113\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-55.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-55.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-55.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-55.png?resize=1536%2C755&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-55.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>A new tab will open, click on &#8220;JSON Tab&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-56.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-56.png?resize=768%2C377&#038;ssl=1\" alt=\"click on &quot;JSON Tab&quot;\" class=\"wp-image-23114\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-56.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-56.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-56.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-56.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-56.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Paste the following into the box and click the &#8220;Next Tags&#8221; button.<\/p>\n\n\n<pre><code class=\"lang-shell\">{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"signer:*\"\n      ],\n      \"Resource\": \"*\"\n    }\n  ]\n}<\/code><\/pre>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-57.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-57.png?resize=768%2C377&#038;ssl=1\" alt=\"Paste the policy into the next step\" class=\"wp-image-23115\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-57.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-57.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-57.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-57.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-57.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Do not add any tags (optional) and click the &#8220;Next Review&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-58.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-58.png?resize=768%2C374&#038;ssl=1\" alt=\"Next Review\" class=\"wp-image-23116\" width=\"768\" height=\"374\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-58.png?resize=1024%2C498&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-58.png?resize=300%2C146&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-58.png?resize=768%2C374&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-58.png?resize=1536%2C747&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-58.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Name: esp32otaupdate-signer-Policy-en<\/li><\/ul>\n\n\n\n<p>and click the &#8220;Create policy&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-59.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-59.png?resize=768%2C376&#038;ssl=1\" alt=\"Creating a policy with a name\" class=\"wp-image-23119\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-59.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-59.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-59.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-59.png?resize=1536%2C752&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-59.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Go back to the previous tab and click on the Refresh Icon, the policy you just created (esp32otaupdate-signer-Policy-en) will be displayed, check it and click on the &#8220;Next Review&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-60.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-60.png?resize=768%2C377&#038;ssl=1\" alt=\"Attaching a policy\" class=\"wp-image-23120\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-60.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-60.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-60.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-60.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-60.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Click on the &#8220;Add permissions&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-61.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-61.png?resize=768%2C375&#038;ssl=1\" alt=\"Adding Access permission\" class=\"wp-image-23121\" width=\"768\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-61.png?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-61.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-61.png?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-61.png?resize=1536%2C750&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-61.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Policies have been added.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-62.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-62.png?resize=768%2C377&#038;ssl=1\" alt=\"esp32otaupdate-Policy-en\" class=\"wp-image-23122\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-62.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-62.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-62.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-62.png?resize=1536%2C755&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-62.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Demo_program_for_OTA_Update\"><\/span>Demo program for OTA Update<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Edit the following file to make the OTA Update demo program work.<\/p>\n\n\n<pre><code class=\"lang-shell\">D:\\GoogleDriveD\\M2B\\FreeRTOS\\vendors\\espressif\\boards\\esp32\\aws_demos\\config_files\\aws_demo_config.h<\/code><\/pre>\n\n\n<p>In the above file<\/p>\n\n\n<pre><code class=\"lang-shell\">#define CONFIG_OTA_UPDATE_DEMO_ENABLED<\/code><\/pre>\n\n\n<p>Define.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-65.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-65.png?resize=768%2C335&#038;ssl=1\" alt=\"Enable the OTA Update demo program.\" class=\"wp-image-22820\" width=\"768\" height=\"335\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-65.png?resize=1024%2C446&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-65.png?resize=300%2C131&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-65.png?resize=768%2C334&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-65.png?w=1401&amp;ssl=1 1401w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>This AWS sample program is designed to work differently depending on the constants that are defined.<\/p>\n\n\n<pre><code class=\"lang-shell\">D:\\GoogleDriveD\\M2B\\FreeRTOS\\demos\\include\\iot_demo_runner.h<\/code><\/pre>\n\n\n<p>The demo program to be executed is sorted in the above file.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>In line 111, it checks if CONFIG_OTA_UPDATE_DEMO_ENABLED is defined or not.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-66.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-66.png?resize=768%2C434&#038;ssl=1\" alt=\"Assigning a working demo program\" class=\"wp-image-22822\" width=\"768\" height=\"434\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-66.png?resize=1024%2C579&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-66.png?resize=300%2C170&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-66.png?resize=768%2C434&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-66.png?w=1083&amp;ssl=1 1083w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Copy_the_certificate\"><\/span>Copy the certificate<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Copy the contents of the code signing certificate (ecsdsasigner.crt) to the Paste code signing certificate here. location in the following file.<\/p>\n\n\n<pre><code class=\"lang-shell\">D:\\GoogleDriveD\\M2B\\FreeRTOS\\demos\\include\\aws_ota_codesigner_certificate.h<\/code><\/pre>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-67.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-67.png?resize=768%2C401&#038;ssl=1\" alt=\"Paste the certificate into aws_ota_codesigner_certificate.h\" class=\"wp-image-22824\" width=\"768\" height=\"401\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-67.png?resize=1024%2C535&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-67.png?resize=300%2C157&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-67.png?resize=768%2C401&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-67.png?w=1136&amp;ssl=1 1136w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>It is important to note that if you copy and paste the file as is, it does not match the format of the C language, and the certificate part will not be recognized during the Build process, resulting in an error due to the reason that &#8220;error missing terminating&#8221;.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Converting_a_certificate\"><\/span>Converting a certificate<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Double-click on the following file (HTML) to open it in your browser for preliminary conversion with the certificate conversion tool.<\/p>\n\n\n<pre><code class=\"lang-shell\">D:\\GoogleDriveD\\M2B\\FreeRTOS\\tools\\certificate_configuration\\PEMfileToCString.html<\/code><\/pre>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-63.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-63.png?resize=768%2C291&#038;ssl=1\" alt=\"Launch the PEM conversion tool.\" class=\"wp-image-23133\" width=\"768\" height=\"291\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-63.png?resize=1024%2C388&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-63.png?resize=300%2C114&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-63.png?resize=768%2C291&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-63.png?resize=1320%2C500&amp;ssl=1 1320w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-63.png?w=1376&amp;ssl=1 1376w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Select the code signing certificate (ecsdsasigner.crt) from the &#8220;Choose File&#8221; button, and then click the &#8220;Display formatted PEM string \u2026&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-65.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-65.png?resize=768%2C315&#038;ssl=1\" alt=\"Certificate conversion tools\" class=\"wp-image-23135\" width=\"768\" height=\"315\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-65.png?resize=1024%2C420&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-65.png?resize=300%2C123&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-65.png?resize=768%2C315&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-65.png?w=1358&amp;ssl=1 1358w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>The certificate with the characters at the end of the line converted for C Language will be displayed.<\/p>\n\n\n\n<p>Copy and paste it into the file( aws_ota_codesigner_certificate.h).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-66.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-66.png?resize=768%2C444&#038;ssl=1\" alt=\"The converted authentication file\" class=\"wp-image-23136\" width=\"768\" height=\"444\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-66.png?resize=1024%2C592&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-66.png?resize=300%2C173&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-66.png?resize=768%2C444&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-66.png?w=1354&amp;ssl=1 1354w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Paste it into aws_ota_codesigner_certificate.h and save it.<\/p>\n\n\n\n<p>Note that the &#8220;;&#8221; (semicolon) at the end is required.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-67.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-67.png?resize=768%2C456&#038;ssl=1\" alt=\"Paste\" class=\"wp-image-23137\" width=\"768\" height=\"456\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-67.png?resize=1024%2C608&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-67.png?resize=300%2C178&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-67.png?resize=768%2C456&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-67.png?w=1050&amp;ssl=1 1050w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"CMake\"><\/span>CMake<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Start the power shell, go to the directory where FreeRTOS installed, and create the build file with the following command.<\/p>\n\n\n<pre><code class=\"lang-shell\">d:\ncd .\\GoogleDriveD\\M2B\\FreeRTOS\\\ncmake -DVENDOR=espressif -DBOARD=esp32_devkitc -DCOMPILER=xtensa-esp32 -G Ninja -S . -B ..\\build\\<\/code><\/pre>\n\n\n<p><a href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos\/#cmakepara\" target=\"_blank\" rel=\"noreferrer noopener\">See the previous article<\/a> for an explanation of the parameters of cmake.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-68.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-68.png?resize=768%2C542&#038;ssl=1\" alt=\"CMake execution results\" class=\"wp-image-23143\" width=\"768\" height=\"542\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-68.png?resize=1024%2C722&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-68.png?resize=300%2C211&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-68.png?resize=768%2C541&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-68.png?w=1101&amp;ssl=1 1101w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Build\"><\/span>Build<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Next, compile the Build file with the following command.<\/p>\n\n\n<pre><code class=\"lang-shell\">cmake --build ..\\build\\<\/code><\/pre>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-69.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-69.png?resize=768%2C541&#038;ssl=1\" alt=\"build result\" class=\"wp-image-23145\" width=\"768\" height=\"541\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-69.png?resize=1024%2C721&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-69.png?resize=300%2C211&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-69.png?resize=768%2C541&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-69.png?w=1100&amp;ssl=1 1100w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Flush\"><\/span>Flush<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>After successfully compiling and creating aws_demos.bin file, connect the ESP32-DevkitC to the PC via USB and write.<\/p>\n\n\n<pre><code class=\"lang-shell\">.\\vendors\\espressif\\esp-idf\\tools\\idf.py flash -b 115200 -B ..\\build\\<\/code><\/pre>\n\n\n<p>Please <a href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos\/#flushpara\" target=\"_blank\" rel=\"noreferrer noopener\">refer to the previous article<\/a> for an explanation of the parameters.<\/p>\n\n\n\n<p>When the new window opens and the writing is finished, the initial firmware preparation is complete.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Updating_the_firmware\"><\/span>Updating the firmware<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The next step is to verify that the firmware is updated by OTA.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Running_ESP32-DevkitC\"><\/span>Running ESP32-DevkitC<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Run ESP32-DevkitC with the firmware before the update (Ver 092) installed and powered from the micro USB Type-B connector.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-90.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-90.jpg?resize=512%2C421&#038;ssl=1\" alt=\"Make sure ESP32-DevkitC is running.\" class=\"wp-image-22874\" width=\"512\" height=\"421\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-90.jpg?resize=1024%2C842&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-90.jpg?resize=300%2C247&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-90.jpg?resize=768%2C632&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-90.jpg?resize=1536%2C1263&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-90.jpg?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Updating_the_version_file\"><\/span>Updating the version file<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Open the following file to change the current version.<\/p>\n\n\n<pre><code class=\"lang-shell\">D:\\GoogleDriveD\\M2B\\FreeRTOS\\demos\\include\\aws_application_version.h<\/code><\/pre>\n\n\n<p>The current version was 092, so I changed it to 093 and saved it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-70.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-70.png?resize=740%2C463&#038;ssl=1\" alt=\"Edit the version control file\" class=\"wp-image-23149\" width=\"740\" height=\"463\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-70.png?w=986&amp;ssl=1 986w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-70.png?resize=300%2C188&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-70.png?resize=768%2C481&amp;ssl=1 768w\" sizes=\"auto, (max-width: 740px) 100vw, 740px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Re-Build\"><\/span>Re-Build <span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Then, re-Build with the following command to create aws_demos.bin of Ver 093.<\/p>\n\n\n<pre><code class=\"lang-shell\">cmake --build ..\\build\\<\/code><\/pre>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-71.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-71.png?resize=768%2C545&#038;ssl=1\" alt=\"Re-Build\" class=\"wp-image-23151\" width=\"768\" height=\"545\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-71.png?resize=1024%2C726&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-71.png?resize=300%2C213&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-71.png?resize=768%2C545&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-71.png?w=1100&amp;ssl=1 1100w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Job_registration_to_AWS\"><\/span>Job registration to AWS<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Create a job for OTA update.<\/p>\n\n\n\n<p>From the AWS console, go to the IoT Core service page and click the Manage -&gt; Jobs -&gt; &#8220;Create Job&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-72.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-72.png?resize=768%2C381&#038;ssl=1\" alt=\"Create an AWS IoT job\" class=\"wp-image-23153\" width=\"768\" height=\"381\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-72.png?resize=1024%2C508&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-72.png?resize=300%2C149&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-72.png?resize=768%2C381&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-72.png?resize=1536%2C762&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-72.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Select &#8220;Create FreeRTOS OTA update job&#8221; and click the &#8220;Next&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-73.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-73.png?resize=768%2C377&#038;ssl=1\" alt=\"Create a FreeRTOS OTA update job\" class=\"wp-image-23154\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-73.png?resize=1024%2C503&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-73.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-73.png?resize=768%2C377&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-73.png?resize=1536%2C754&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-73.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"OTA_Job_Properties\"><\/span>OTA Job Properties<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>Job name: esp32-ota-updatejob-en<\/li><\/ul>\n\n\n\n<p>Click the &#8220;Next&#8221; button without setting the description and tags (optional).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-74.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-74.png?resize=768%2C376&#038;ssl=1\" alt=\"Setting the job name\" class=\"wp-image-23155\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-74.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-74.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-74.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-74.png?resize=1536%2C751&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-74.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Select &#8220;Thing Groups&#8221; or &#8220;Things&#8221; for the device to be updated.<\/p>\n\n\n\n<p>In this case, I selected &#8220;ESP-WROOM-32-GGTest&#8221; and &#8220;Things&#8221;, so the things (devices) will be updated with pinpoint accuracy.<\/p>\n\n\n\n<p>Specify the name that you set in <a href=\"https:\/\/www.souichi.club\/en\/aws\/amazon-freertos\/#regidevice\" target=\"_blank\" rel=\"noreferrer noopener\">the previous article<\/a> on registering devices.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-75.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-75.png?resize=768%2C378&#038;ssl=1\" alt=\"selection of goods\" class=\"wp-image-23158\" width=\"768\" height=\"378\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-75.png?resize=1024%2C504&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-75.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-75.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-75.png?resize=1536%2C756&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-75.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Select &#8220;MQTT&#8221; as the secure protocol and scroll down.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-76.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-76.png?resize=768%2C375&#038;ssl=1\" alt=\"Specify MQTT as the protocol.\" class=\"wp-image-23159\" width=\"768\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-76.png?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-76.png?resize=300%2C146&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-76.png?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-76.png?resize=1536%2C750&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-76.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Sign a new file for me.<\/li><\/ul>\n\n\n\n<p>and click the &#8220;Create new profile&#8221; button in the Existing code signing profile.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-77.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-77.png?resize=768%2C381&#038;ssl=1\" alt=\"Creating a new profile\" class=\"wp-image-23160\" width=\"768\" height=\"381\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-77.png?resize=1024%2C508&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-77.png?resize=300%2C149&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-77.png?resize=768%2C381&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-77.png?resize=1536%2C762&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-77.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Profile name: esp32_ota_profile_en<\/li><li>Hardware platform of the device: ESP32-DevKitC<\/li><\/ul>\n\n\n\n<p>and select &#8220;Import a new code signing certificate&#8221; and scroll down.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-82.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-82.png?resize=768%2C257&#038;ssl=1\" alt=\"Create a new code signing profile\" class=\"wp-image-23167\" width=\"768\" height=\"257\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-82.png?resize=1024%2C343&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-82.png?resize=300%2C100&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-82.png?resize=768%2C257&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-82.png?resize=1536%2C514&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-82.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Certificate body: Code signing certificate (ecsdsasigner.crt)<\/li><li>Certificate private key: Private key (ecsasigner.key)<\/li><\/ul>\n\n\n\n<p>and click the &#8220;Import&#8221; button to upload the file, then scroll down.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-80.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-80.png?resize=768%2C375&#038;ssl=1\" alt=\"Importing certificates\" class=\"wp-image-23165\" width=\"768\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-80.png?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-80.png?resize=300%2C146&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-80.png?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-80.png?resize=1536%2C750&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-80.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Path name of codes signing certificate on device: \/OTA_Cert\/auth.pem<\/li><\/ul>\n\n\n\n<p>and click the &#8220;Create&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-81.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-81.png?resize=768%2C378&#038;ssl=1\" alt=\"Pathname of the device's code signing certificate\" class=\"wp-image-23166\" width=\"768\" height=\"378\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-81.png?resize=1024%2C504&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-81.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-81.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-81.png?resize=1536%2C756&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-81.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>Go back to the previous screen and scroll down to the bottom where the profile (esp32_ota_profile_en) has been created and selected.<\/p>\n\n\n\n<p>Select &#8220;Choose file&#8221; and upload aws_demos.bin of the rebuilt Ver 093.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>S3 URL: Bucket name (s3:\/\/esp-wroom-32-ota-en)<\/li><li>Path name of file on device: \/device<\/li><\/ul>\n\n\n\n<p>and scroll down.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-83.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-83.png?resize=768%2C378&#038;ssl=1\" alt=\"Uploading updated firmware\" class=\"wp-image-23169\" width=\"768\" height=\"378\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-83.png?resize=1024%2C504&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-83.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-83.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-83.png?resize=1536%2C756&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-83.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Role: esp-32-ota-role-en<\/li><\/ul>\n\n\n\n<p>Select the first role you created and click the &#8220;Next&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-84.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-84.png?resize=768%2C376&#038;ssl=1\" alt=\"Selecting a role\" class=\"wp-image-23171\" width=\"768\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-84.png?resize=1024%2C501&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-84.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-84.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-84.png?resize=1536%2C751&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-84.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_a_Job\"><\/span>Creating a Job<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Now that the configuration is complete, create the job.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Job run type: Your job will complete after deploying to the devices and groups that you chose(snapshot)<\/li><li>Job start rollout configuration: Not configured (optional)<\/li><li>Job stop configuration: Not set (optional)<\/li><li>Job run timeout configuration: Not set (optional)<\/li><\/ul>\n\n\n\n<p>Click the &#8220;Create Job&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-85.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-85.png?resize=768%2C377&#038;ssl=1\" alt=\"Creating a Job\" class=\"wp-image-23172\" width=\"768\" height=\"377\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-85.png?resize=1024%2C502&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-85.png?resize=300%2C147&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-85.png?resize=768%2C376&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-85.png?resize=1536%2C753&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-85.png?w=1920&amp;ssl=1 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<p>A job will be created and OTA Update will be executed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"OTA_Update\"><\/span>OTA Update<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>After waiting for a while, the firmware update will be done automatically, so check the log of the ESP32-DevkitC serial console.<\/p>\n\n\n\n<p>You can see that the job has been executed and the version has been upgraded to 0.9.3 via MQTT protocol.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a class=\"r_image\" href=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-91.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-91.png?resize=768%2C480&#038;ssl=1\" alt=\"OTA Update log\" class=\"wp-image-22877\" width=\"768\" height=\"480\" srcset=\"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-91.png?resize=1024%2C640&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-91.png?resize=300%2C187&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-91.png?resize=768%2C480&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-91.png?w=1405&amp;ssl=1 1405w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_End\"><\/span>The End<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>With the Amazon FreeRTOS OTA Update demo project, I was able to confirm that it automatically updates to the latest firmware.<\/p>\n\n\n\n<p>Setting up roles and policies in advance is complicated and a bit of a hassle, but once it&#8217;s done, OTA Update itself is not that difficult as it is automatically updated via MQTT protocol by simply creating a job.<\/p>\n\n\n\n<p>In addition, the private key and code signing certificate will be checked by AWS Certificate Manager, so it is nice to have a secure IoT device environment.<\/p>\n\n\n\n<p>This concludes this article.<\/p>\n\n\n\n<p>Translated with www.DeepL.com\/Translator (free version)<\/p>\n\n\n<div class=\"postscript_balloon\">Finally.<\/div>\n\n\n<p>I hope this article will be useful to someone somewhere.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the case of IoT, a large number of terminals may be placed here and there, so it is very inefficient to have a human being going around updating the program.<\/p>\n","protected":false},"author":5,"featured_media":22918,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"https:\/\/www.souichi.club\/?p=22068","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-22911","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws","en-US"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.souichi.club\/wp-content\/uploads\/amazon-freertos-ota-en-01.png?fit=1920%2C1080&ssl=1","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/posts\/22911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/comments?post=22911"}],"version-history":[{"count":1,"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/posts\/22911\/revisions"}],"predecessor-version":[{"id":24530,"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/posts\/22911\/revisions\/24530"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/media\/22918"}],"wp:attachment":[{"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/media?parent=22911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/categories?post=22911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.souichi.club\/wp-json\/wp\/v2\/tags?post=22911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}