AWS Elastic Beanstalk removes EC2 instance creates it again when my server is down
Solution 1:
This is intended behavior. Beanstalk uses autoscaling to manage instances, and autoscaling will terminate instances if there is a problem.
If you want to to make sure the new instance that is started is configured in exactly the same way, you need to bootstrap all configurations. You use ebextensions to do this. https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html
You should never rely on manual configurations with Beanstalk. If there is something you need to do on an instance before it works, you need to write a script and include that in your ebextensions. Add the script to /tmp in the "files" section, and in the "commands" or "container commands" section, you can execute that script.
To include ebextensions, create a directory at the root level of your source code name ".ebextensions". Files in this directory should end with the ".config" extension, and are all yaml files. https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html