We are running into a real thorny situation where agent-monitored aws servers are being shutdown and re-built with a SAM agent in the image. Because the previous node is still in SAM the newly registered agent does not add itself as a node and requires manual intervention to both delete the previous node and redeploy agent to the new one.
While we are considering an automation where autoscale or ec2 deletion event triggers a node deletion from SAM but this is not our preferred solution due to the quick timing needed and loss of historical data.
Anyone else have a better solution?