Configuring Health Checks

You can configure health checks to periodically test the availability and the health of the backend virtual machines (VMs) of a load balancer in order to send requests only to healthy and available ones. You can configure only one health check type per load balancer, specifying the backend VMs port and protocol to check.

Health checks consist in sending regular requests to backend VMs at a specified time interval. A backend VM is considered healthy or unhealthy depending on a specified number of consecutive successful or failed requests. A request is considered failed when a VM does not respond to this request within a specified time period. When a VM previously considered unhealthy becomes healthy again, the load balancer automatically sends requests to it again, with no action on your side.

Configuring Health Checks Using OSC CLI

The UpdateLoadBalancer command modifies the specified attribute of a load balancer. You can specify only one attribute at a time.

You can set a new SSL certificate to an SSL or HTTPS listener of a load balancer.
This certificate replaces any certificate used on the same load balancer and port.

You can also replace the currently enabled policy for the load balancer with another one.
If the PolicyNames parameter is empty, the currently enabled policy is disabled.

Request sample: Updating health checks
$ osc-cli api UpdateLoadBalancer --profile "default" \
    --LoadBalancerName "private-lb-example" \
    --HealthCheck '{
        "HealthyThreshold": 10,
        "CheckInterval": 30,
        "Path": "/index.html",
        "Port": 8080,
        "Protocol": "HTTPS",
        "Timeout": 5,
        "UnhealthyThreshold": 5,
      }'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • HealthCheck: (optional) Information about the health check configuration.

  • LoadBalancerName: The name of the load balancer.

The UpdateLoadBalancer command returns the following elements:

  • LoadBalancer: Information about the load balancer.

  • ResponseContext: Information about the context of the response.

Result sample: Updating health checks
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "LoadBalancer": {
    "Tags": [],
    "SourceSecurityGroup": {
      "SecurityGroupName": "security-group-example",
      "SecurityGroupAccountId": "123456789012"
    },
    "SecuredCookies": false,
    "PublicIp": "192.0.2.0",
    "Subnets": [
      "subnet-12345678"
    ],
    "NetId": "vpc-12345678",
    "BackendVmIds": [],
    "ApplicationStickyCookiePolicies": [],
    "SecurityGroups": [
      "sg-12345678"
    ],
    "LoadBalancerType": "internet-facing",
    "AccessLog": {
      "PublicationInterval": 60,
      "IsEnabled": false
    },
    "DnsName": "private-lb-example.123456789.eu-west-2.lbu.outscale.com",
    "HealthCheck": {
      "UnhealthyThreshold": 5,
      "Timeout": 5,
      "CheckInterval": 30,
      "Path": "/index.html",
      "Protocol": "HTTPS",
      "HealthyThreshold": 10,
      "Port": 8080
    },
    "LoadBalancerStickyCookiePolicies": [],
    "SubregionNames": [
      "eu-west-2a"
    ],
    "Listeners": [
      {
        "ServerCertificateId": "orn:ows:idauth::012345678910:server-certificate/Certificate",
        "BackendPort": 80,
        "BackendProtocol": "HTTP",
        "LoadBalancerPort": 443,
        "LoadBalancerProtocol": "HTTPS"
      }
    ],
    "LoadBalancerName": "private-lb-example"
  }
}

Configuring Health Checks Using AWS CLI

To configure health checks for a load balancer, use the configure-health-check command following this syntax:

Request sample
$ aws elb configure-health-check \
    --profile YOUR_PROFILE \
    --load-balancer-name LB_NAME \
    --health-check Target=HTTP:80/home/index.html,Interval=60,Timeout=5,UnhealthyThreshold=5,HealthyThreshold=2 \
    --endpoint https://lbu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • load-balancer-name: The name of the load balancer.

  • health-check: The configuration for the health checks. This attribute requires the following elements:

    • Target: The backend instances protocol and port to check, in the protocol:port/path format.

      You can type the following values:

      • Protocol: TCP, SSL, HTTP, or HTTPS

      • Port: Between 1 and 65535 (both included)

      • Path: If you use the HTTP or HTTPS protocols, the request URL path (for example, HTTP:80/index.html)

    • Interval: The number of seconds between two requests (between 5 and 600 both included, by default 30).

    • Timeout: The maximum waiting time for a response before considering the instance as unhealthy, in seconds (between 2 and 60 both included, by default 5).

    • UnhealthyThreshold: The number of consecutive failed requests to consider the instance as unhealthy (between 2 and 10 both included, by default 2).

    • HealthyThreshold: The number of consecutive successful requests to consider the instance as healthy (between 2 and 10 both included, by default 10).

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The configure-health-check command returns the following elements:

  • HealthCheck: Information about the updated health checks. This element contains the following information:

    • HealthyThreshold: The number of consecutive successful requests to consider the instance as healthy.

    • Interval: The number of seconds between two requests.

    • Target: The backend instances protocol and port to check, and the request URL path if you are using HTTP protocol.

    • Timeout: The maximum waiting time for a response before considering the instance as unhealthy, in seconds.

    • UnhealthyThreshold: The number of consecutive failed requests to consider the instance as unhealthy.

Result sample
{
   "HealthCheck": {
       "HealthyThreshold": 2,
       "Interval": 60,
       "Target": "HTTP:80/home/index.html",
       "Timeout": 5,
       "UnhealthyThreshold": 5
   }
}

The health checks are configured for the specified load balancer.

Related Pages

Corresponding API Methods

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.