I don't think this is possible using default auto scaling.
Auto scalings termination policy is:
- Terminate instance in AZ with largest number of instances.
- Oldest launch configuration
- Closest to billing hour
If you have one AZ the solution could be to change the launch configuration. Even if it's just a copy of the current one that's enough. That's not immediate though, that's eventually if things scale up and down regularly.
If you have multiple AZs a new launch configuration will work eventually.
You could manually protect instances from termination. That's manual though, and you'd have to change them on each zip file release.
Lambda gives you a lot of power and flexibility. You could have CloudWatch Events trigger a Lambda function. That function could check date of the latest zip file and dates of instance launch, and could terminate instances that are older than the zip file. This is probably the best automated way to do things.
Manual termination could possibly be easiest, so long as you don't release zip files too often.
- How many AZs are you using?
- How often do you release zip files?