espressif / esp-aws-iot

AWS IoT SDK for ESP32 based chipsets
Apache License 2.0
266 stars 157 forks source link

Beta ?? Fleet Provisioning example?? (CA-166) #74

Closed SolidStateLEDLighting closed 2 years ago

SolidStateLEDLighting commented 2 years ago

I'm digging through the Beta -- can I safely assume that the mqtt example is going to lead to success in Fleet Provisioning??

I already achieved Fleet Provisioning in the old esp-aws-iot software, but the new build is a whole new animal and I'm starting over with Fleet Provisioning now.

Fleet Provisioning (and possibly the option for Certificate rotation) is a must have for all large scale developers. Why would you pass this over when your largest customers would most certainly require it???

SolidStateLEDLighting commented 2 years ago

I have completed Fleet Provision by claim. I used the mqtt tls mutual authentication example as my guide and everything works well. The only required change is that the user must increase the MQTT_NETWORK_BUFFER_SIZE to 4096.

SolidStateLEDLighting commented 2 years ago

BIG WARNING: Cert/Keys which are received from AWS (for Provisioning) must be cleared of all string "/n" and those replaced with '/n' characters at the end of each 64 char block. Be extra careful that final string retains '/n' and '/0' on the end or cert/key may fail. You may need to append stored cert/key with '\0' character after pulling them back out of NVM so they totally match the format of any normally embedded cert/key.

RobertFoll commented 2 years ago

Are there any guides or examples on using fleet provisioning with ESP32?

SolidStateLEDLighting commented 2 years ago

I made Fleet Provisioning work with the older (current) sdk and also the new beta library.

It is not much more than a series of subscriptions and publishing. All of it is pretty well explained in the AWS IOT Core documents.

Order of operations is critical to success.

The bear is going to be getting all your roles and policies, and template all set up correctly at AWS.

One last thing that you're not going to like is that when you finally get your cert and key -- you'll will likely need to strip out the 2-character LFs "\n"(which are ascii printable as \n) and replace those with the non-printable single character '\n' (you can see them in action but they are not characters on the screen) -- before you store your cert/key to NVM.

Once you have the cert/key then you restart your log-in process as demonstrated for Shadow work.

The need that is supremely over-looked right now is the full integration of all the features in one large example. Fleet/Shadow/Jobs/OTA They have OTA details abstracted away in a form that is completely disassociated from the fundamental Fleet/Shadow process. I'm working on the Jobs/OTA portion of it right now.

Keith


From: RobertFoll @.> Sent: Wednesday, December 29, 2021 9:04 PM To: espressif/esp-aws-iot @.> Cc: keith ssledlighting.com @.>; Author @.> Subject: Re: [espressif/esp-aws-iot] Beta ?? Fleet Provisioning example?? (CA-166) (Issue #74)

Are there any guides or examples on using fleet provisioning with ESP32?

— Reply to this email directly, view it on GitHubhttps://github.com/espressif/esp-aws-iot/issues/74#issuecomment-1002584675, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGGOKE5QG6YIC2AYQTQOX4LUTMBONANCNFSM5IA3KDIQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

RobertFoll commented 2 years ago

Thank you very much for your detailed response. It is very much appreciated! I will try this out when I have time!

SolidStateLEDLighting commented 2 years ago

I forget to mention one important thing.. I write in C++. That adds a bit more difficulty in some situations because of name mangling and stricter structure initialization. Some of what I wrote previously you may not see if writing in just C.


From: RobertFoll @.> Sent: Thursday, December 30, 2021 3:23 AM To: espressif/esp-aws-iot @.> Cc: keith ssledlighting.com @.>; Author @.> Subject: Re: [espressif/esp-aws-iot] Beta ?? Fleet Provisioning example?? (CA-166) (Issue #74)

Thank you very much for your detailed response. It is very much appreciated! I will try this out when I have time!

— Reply to this email directly, view it on GitHubhttps://github.com/espressif/esp-aws-iot/issues/74#issuecomment-1002744075, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGGOKEYY2IUTZXPCVMZVDGLUTNNZ3ANCNFSM5IA3KDIQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

SolidStateLEDLighting commented 2 years ago

I have fleet provisioning working now....