- Newest
- Most votes
- Most comments
May referring this:
- Custom Drift Detection Component Deploy a lightweight Greengrass component (e.g., com.example.DriftDetector) that: • Periodically checks the local component list (/greengrass/v2/work/com.aws.greengrass.componentName/). • Compares it to the expected components from the thing group deployment (fetched via ListEffectiveDeployments or ListInstalledComponents). • Detects missing or outdated components.
- Trigger a Redeployment If drift is detected: • Use the AWS SDK (e.g., Python boto3) to call CreateDeployment for the affected thing or thing group. • Optionally, revise the existing deployment with no changes to force a redeploy.
- Automate with CloudWatch or Lambda • Use CloudWatch metrics or IoT Device Defender to monitor component health. • Trigger a Lambda function to initiate redeployment when unhealthy states or drift are detected.
For this usecase, you may also want to have different things name for primary and secondary with both of them being on the same thing group. If the disk failure does occur you can see it in the console as well as re-trigger the deployment.
UPDATE: July 11: My original answer was highlighting potential difficulties with fleet status service sequence numbers. However, it seems the Greengrass cloud service changed its handling some months ago, and therefore that should not be an issue anymore. APIs such as ListInstalledComponents should reliably report current state after the cutover to the secondary SD card.
I still recommend that you do NOT revise/create a deployment. Instead, remove the thing from the thing group, and then add it back in. This will create a new job execution for just that affected device. If you revised the deployment, you would send a new job execution to every device in the fleet.
To reduce (but not eliminate) the chances of going into a bad state, you could periodically sync the application state with a tool like fsync.
Or run the SD cards as mirrors of each other. (Now a full backup rather than minimal)
Relevant content
- asked 2 years ago