- Newest
- Most votes
- Most comments
Hello,
Yes, there are methods to provision Android devices to connect to AWS IoT MQTT message broker without manual provisioning steps, even with the newer SDK v2. AWS IoT Core offers a feature called fleet provisioning that allows you to generate and securely deliver device certificates and private keys to your devices when they connect to AWS IoT for the first time.
With fleet provisioning, you can implement a process similar to what you were doing with SDK v1, but in a more secure and scalable manner. Here's how you can approach this:
-
Set up a fleet provisioning template in AWS IoT Core. This template defines the resources and permissions that will be assigned to your devices.
-
In your Android app, you'll need to include a provisioning claim certificate. This is a temporary certificate that allows the device to connect to AWS IoT Core for the purpose of exchanging it for a unique certificate.
-
When your app runs for the first time on a customer's device, it can use this claim certificate to connect to AWS IoT Core and request a unique certificate for that device.
-
AWS IoT Core will then generate a new certificate and private key for the device and send it back securely.
-
Your app can then store this new certificate and private key securely on the device (e.g., in the Android Keystore) and use it for all future connections to AWS IoT Core.
This process allows you to provision devices programmatically without any manual steps on the customer's device. It's more secure than the previous method because each device gets a unique certificate, and you have more control over the provisioning process through the fleet provisioning template.
To implement this with SDK v2, you would use the AWS IoT Device SDK for Java v2, which includes support for fleet provisioning. The exact code would be different from your SDK v1 example, but the overall process remains similar - connecting with a temporary credential, requesting a permanent credential, and then using that for future connections.
Remember to handle error cases and implement retry logic in case of network issues during the provisioning process. Also, ensure that you're following best practices for storing sensitive information like certificates and private keys on Android devices.
Resources
Device provisioning - IoT Lens
answered 2 years ago
Relevant content
asked 4 years ago
asked 4 years ago
asked 3 years ago
- AWS OFFICIALUpdated 2 years ago
