Amazon EC2 Auto Scaling now lets you control which instances to terminate during a scale-in event by allowing you to provide a custom function that selects which instances to terminate. Previously, you could use one of the predefined termination policies to determine which instances Auto Scaling would terminate. (For example, the OldestLaunchTemplate termination policy would terminate instances in order of their launch template age, oldest first.) Now, you can provide a custom Lambda function that indicates which instances are safe to terminate on scale in. This feature is useful for stateful applications where you want to control which instances Auto Scaling terminates so that your application is not disrupted on scale in.
Source:: Amazon AWS