- Log in to your AWS account and open AWS IoT Core.
- Navigate to Security > Policies > Create policy.
- Enter a relevant policy name.
- Copy the contents from demos/fleet_provisioning/fleet_provisioning_with_csr (or fleet_provisioning_keys_cert_demo)/example_claim_policy.json.
- Paste the copied content into the policy document on the AWS console.
- Click "Create policy".
- In AWS IoT Core, go to Security > Certificates > Add certificate.
- Set the "Certificate Status" to active.
- Download the certificate files from the provided prompt.
- Update the demo_config.h file:
- Set CLAIM_CERT_PATH to the path of the downloaded certificate.
- Set CLAIM_PRIVATE_KEY_PATH to the path of the downloaded private key. Note: You can also set these values using command line parameters.
- Select the certificate, click "Attach policies", choose your provisioning policy, and click "Attach policy".
- Go to the IAM Identity Center.
- Create a new IAM role.
- When prompted, select AWS IoT as the service.
- Navigate to AWS IoT Core > Connect many devices > Connect many devices > Create provisioning template.
- Choose "Provisioning devices with claim certificates" and click "Next".
- Set the status to active.
- Enter a template name.
- Select the IAM role you created earlier (or create a new one if needed).
- Choose the provisioning policy you created earlier (or create a new one if needed).
- Select "Don't use a pre-provisioning action".
- Enable the automatic thing creation option and click "Next".
- Select or create a policy for your device's permissions (e.g., connecting to IoT, subscribing/publishing to topics).
- Click "Next", review the settings, and create the template.
Set all necessary macro values in the demo_config.h file. Alternatively, you can provide these values through command line parameters.