No Code here.
I am building solution based on EC2 using AutoScaling.
I have created the solution where instance will get detached from AutoScaling group before they are stopped and they will be added back to AutoScaling group when in use. Now what if the instance that I have deteched from AutoScaling has terminated, now I am left with nothing to attach to AutoScaling ( that particular instance id does not exist anymore).
How to handle this , if instance has terminated then at time of attachment AutoScaling should know that Instance does not exist anymore and create a new instance. From here i am planning to create a event bridge which will take Instance-Id of new instance and update it SSM.