fbpx

Architecture

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 to 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 HCS, Spotinst will replace it with a new instance according to the Elastigroup config.

Follow these steps to configure Spotinst Health Check:
Step 1

Create a Spotinst Elastigroup if you do not have one already.

Step 2

In the Compute part select “HCS” as HealthCheck Type.

  1. Go to your Elastigroup and click on Edit.
  2. On the Compute tab, in the Launch Specification section, set the health check type to HCS and update the group.
Step 3

Install the Spotinst Health Check Service on an instance ( we recommend a dedicated On-Demand instance) within your secured VPC.

  1. Choose one of your instances that will act as the proxy, on which you should later install the docker.
  2. 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 with Spotinst IP range whitelisted as listed in the following link: Spotinst Whitelabel IPs
  3. SSH into your EC2 Instance and Install the Health Check service:
    1. Install Docker first.
    2. Run the following command to pull the docker image:
      docker run -d --restart=always -p 80:80 spotinst/healthcheck:latest

      Alternatively, you can configure use the following user data 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
      
Step 4

Set the Health Check configuration in the Elastigroup:

  1. Go to your Elastigroup and click on the “Actions” menu at the top left. Click on “Set Health Check” from the menu:
  2. 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

 

Note: You can do steps 3 and 4 via our API. 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:

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