Auto-Recovery of AWS EC2 instance

04 / Sep / 2015 by Mohit Dayal Gupta 4 comments

You can now Auto-Recover your AWS EC2 instance in the case of failures from Amazon side. Whether it is a hardware problem, underlying host problem or any other problem that occurs from Amazon side to your AWS EC2 instance, the instance can be recovered automatically.  It increases the availability of the instances provided by Amazon to a large extent.

I had a use case while working on a project. The project is aimed at building an Android application in which different modules of the application are hosted on different EC2 instances. The modules are dependent on each other and failure of any module affects every other module and may lead to downtime of application.

All of a sudden, an instance status check failed. After spending some time on the issue, we found that the problem occurred due to some lag from Amazon side. The application stopped to respond and the affected server was unable to reboot for few minutes, which conclusively lead to the downtime of application.

To prevent such unfortunate conditions and to ensure the availability of your instances, many different alternatives could be chosen. The alternatives may include Auto-Scaling or Auto-Recovery. Auto-Recovery is the best option if you are cost concerned . This feature helps you to recover your instances automatically when the system shows some unhealthy condition due to impairment. It lets you sit back and do the needful recovery from your side. Some basic advantages include:

    • The running instance is automatically transferred to the new underlying hardware.
    • There is no need of migration to a new EC2 instance.
    •  The instance-id does not get changed.
    • The IP address, if it is an Elastic IP address remain same.
    • The instance metadata and the private IP addresses also remain same.

Some important considerations include:

    • It is only supported on C3, R3, M3, C4 and T2 instance types
    • The elastic IP should be allocated to the instance. After recovery, the instance will lose its public IP if it is not an elastic IP

 

HOW TO ENSURE AUTOMATIC-RECOVERY OF EC2 INSTANCE

AWS Cloudwatch is used to monitor the instances and auto-recovery in case of any type of impairment of the system. Whenever status check fail occurs, the SNS feature notifies and the recovery action takes place. Following are the steps:-

  1. Go to your EC2 instance on your AWS console. In my case, the instance is “Send_RDS_Logs”.Going to EC2 instance

2.  Go to monitoring after selecting your EC2 instance. Click on “Create Alarm.”

       Monitoring EC2

3. On “Take the Action” checkbox choose “Recover this instance”.

       Selection_078

Now, the instance has been set up to Auto-Recovery. The instance will be automatically recovered in case of any system impairment.

FOUND THIS USEFUL? SHARE IT

comments (4)

  1. kiran

    Hi,

    Could you please tell me, how can this EC2 recovery option enable automatically if the new ec2 instance spin up through auto scalling….?

    Thanks,
    Kiran

    Reply
    1. vaibhav

      I believe that when you launch new vms in autoscaling .. it will check for the instance check as per cloudwatch.. if no response then it will automatically launch a new instance..

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *