skip to Main Content

This might feel like a silly question but I ran into some issue where my EC2 instance was going down once in a while, now i have made some alternate to it, so that another instance will take over to this instance when this happens but i want to test this before i productionize the change.

I did some basic research on AWS blog post but don’t see any relevant answer.

Thanks in advance for the help!

2

Answers


  1. The instance status check tries to connect to the instance and fails if it can’t.

    An easy way to trigger an instance status check failure is to disable the default NIC in the instance. For Linux instances, run the following on startup:

    sudo ifconfig eth0 down
    
    Login or Signup to reply.
  2. If you are using CloudWatch alarms to trigger the takeover, you can use set-alarm-state command to simulate the alarm.

    Also, you seem to be reinventing a well-established pattern of an application load balancer with an autoscaling group with min/max/desired size set to one. ASG will replace the instance on the EC2 health-check failure out-of-the box, but you can also add an optional application health check on the ALB.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search