Question

I have an Amazon EC2 instance with AutoScaling and Load balancer.

I deployed an application and configured Apache.

Everything went fine but Amazon for some reason terminated my instance and started a new one. I lost all the code and configuration there?

What should I do? Maybe attach a EBS volume and deploy everything there? But my Apache server is installed on the main volume.

Can anyone help me?

Was it helpful?

Solution

If you are using autoscaling, instances will be terminated if they become unhealthy. In order to use autoscaling effectively, you should not keep any persistant data on the instance itself. This is called Shared Nothing architecture.

What you want to do, is create an AMI that has all your application and or tools to bootstrap your application. You would use this AMI as part of the launch configuration for your autoscale group. So if a new instance gets launched, either due to failure or needing to scale, your application will be back up without any interaction from you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top