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:
Create a Spotinst Elastigroup if you do not have one already.
Install the Spotinst
Health Check Service on an instance ( we recommend a dedicated On-Demand instance) within your secured VPC.
- Choose one of your instances that will act as the
proxy, on which you should later install the docker.
- Create a Security Group and attach it to the instance. This Security Group allows input traffic from Spotinst Health Check Service in
Port TCP 80with Spotinst IP range whitelisted as listed in the following link: Spotinst Whitelabel IPs
- SSH into your EC2 Instance and Install the Health Check service:
- Install Docker first.
- 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
Set the Health Check configuration in the Elastigroup:
- Go to your Elastigroup and click on the “Actions” menu at the top left. Click on “Set Health Check” from the menu:
- 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
- UnhealthyThreshold: The number of consecutive failed health checks that must occur before declaring an instance
- HealthyThreshold: The number of consecutive successful health checks that must occur before declaring an instance
In the Compute part select “HCS” as HealthCheck Type.
- Go to your Elastigroup and click on Edit.
- On the Compute tab, in the Launch Specification section, set the health check type to
HCSand update the group.
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.