Getting started with Spotinst Health Check service

Reading Time: 3 minutes

As we previously announced, our new Elastigroup HCS service is now released.
In this post you will find the steps you need to follow in order to configure the service in your VPC.
So, let’s get started.

Architecture

Screen Shot 2016-05-04 at 21.52.49

The Spotinst Health Check service will be installed on your VPC. You should open traffic from your Elastigroup to Spotinst Security Group and to one of your instances that will be assigned as a Security Group.

How it works

The Spotinst Health Check service will act as a proxy between Spotinst hosts and your
EC2 private instances in your VPC.
Spotinst will trigger the proxy service on each check. The proxy will communicate with your private instances in the VPC and will send the results to Spotinst.
When an instance is marked as unhealthy, and the Elastigroup Health Check type is set to CUSTOM, Spotinst will replace it with a new instance according to the Elastigroup config.

Follow these steps to configure Spotinst Health Check:

    1. Create a Spotinst Elastigroup if you do not have one already.
    2. In the Compute part select “HCS” as HealthCheck Type.
      a. Go to your Elastigroup and click on Edit.
      b. On the Compute tab, in the Launch Specification section, set the health check type to HCS and update the group.
    3. Install the Spotinst Health Check Service on of your instance within your secured VPC.
      a. Choose one of your instances that will act as the proxy, on which you should later install the docker.
      b. Create a Security Group and attach it to the instance. This Security Group allows input traffic from Spotinst Health Check Service in Port TCP 80 for the Spotinst Whitelabeled IPs
      c. SSH into your EC2 Instance and Install the Health Check service:

      i. Install Docker first.
      ii. Run the following command to pull the docker image

       docker pull spotinst/healthcheck

      iii. Run the following command to run the service:

       docker run -d --restart=always -p 80:80 spotinst/healthcheck:latest

      Alternatively, you can configure use the following userdata script to install docker and the HCS service.

      #!/bin/bash
      sudo yum update -y
      sudo yum install -y docker
      sudo service docker start
      sudo usermod -a -G docker ec2-user
      sudo docker pull spotinst/healthcheck
      sudo docker run -d --restart=always -p 80:80 spotinst/healthcheck:latest
      
      
    4. Set the Health Check configuration in the Elastigroup.
      a. Go to your Elastigroup and click on the “Actions” menu at the top left. Click on “Set Health Check” from the menu

      b. Define the Health Check properties:

      Name: Name your Health Check for convenience.
      ProxyAddress: The public host/IP of your selected instance you installed service on in section 2. This will be set like http://publicip
      Protocol: Which protocol will Spotinst use to check the healthiness of your instances. Supported for now are: http / https.
      Endpoint: The path of the Health Check in each instance.
      Interval: The interval (in seconds) between the checks. Minimum of 10.
      Timeout: The timeout (in seconds) to wait for each instance to answer the check. If it did not answer, we mark this attempt as unhealthy
      UnhealthyThreshold: The number of consecutive failed health checks that must occur before declaring an instance unhealthy
      HealthyThreshold: The number of consecutive successful health checks that must occur before declaring an instance healthy

      HCS Set

      You can do steps 3 and 4 via our API too. For more information go to Our API wiki.

Now – the health check is running, and Spotinst’s monitor service will send HCS requests according to the specified interval.
The healthiness should be available shortly through the Instances table list:
Screen Shot 2016-06-08 at 10.48.05 AM

In case of an Instance failure – the HCS service will trigger a replacement operation to launch a new instance and terminate the unhealthy one.

Screen Shot 2016-06-08 at 10.47.08 AM

 

That’s all for today!

 

Best Regards,
The Spotinst Team.