Expand description
Health Checks determine whether instances are responsive and able to do work. They are an important part of a comprehensive load balancing configuration, as they enable monitoring instances behind load balancers.
Health Checks poll instances at a specified interval. Instances that do not respond successfully to some number of probes in a row are marked as unhealthy. No new connections are sent to unhealthy instances, though existing connections will continue. The health check will continue to poll unhealthy instances. If an instance later responds successfully to some number of consecutive probes, it is marked healthy again and can receive new connections.
~>NOTE: Legacy HTTP(S) health checks must be used for target pool-based network load balancers. See the official guide for choosing a type of health check.
To get more information about HealthCheck, see:
- API documentation
- How-to Guides
§Example Usage
§Health Check Tcp
resources:
tcp-health-check:
type: gcp:compute:HealthCheck
properties:
name: tcp-health-check
timeoutSec: 1
checkIntervalSec: 1
tcpHealthCheck:
port: '80'
§Health Check Tcp Full
resources:
tcp-health-check:
type: gcp:compute:HealthCheck
properties:
name: tcp-health-check
description: Health check via tcp
timeoutSec: 1
checkIntervalSec: 1
healthyThreshold: 4
unhealthyThreshold: 5
tcpHealthCheck:
portName: health-check-port
portSpecification: USE_NAMED_PORT
request: ARE YOU HEALTHY?
proxyHeader: NONE
response: I AM HEALTHY
§Health Check Ssl
resources:
ssl-health-check:
type: gcp:compute:HealthCheck
properties:
name: ssl-health-check
timeoutSec: 1
checkIntervalSec: 1
sslHealthCheck:
port: '443'
§Health Check Ssl Full
resources:
ssl-health-check:
type: gcp:compute:HealthCheck
properties:
name: ssl-health-check
description: Health check via ssl
timeoutSec: 1
checkIntervalSec: 1
healthyThreshold: 4
unhealthyThreshold: 5
sslHealthCheck:
portName: health-check-port
portSpecification: USE_NAMED_PORT
request: ARE YOU HEALTHY?
proxyHeader: NONE
response: I AM HEALTHY
§Health Check Http
resources:
http-health-check:
type: gcp:compute:HealthCheck
properties:
name: http-health-check
timeoutSec: 1
checkIntervalSec: 1
httpHealthCheck:
port: 80
§Health Check Http Full
resources:
http-health-check:
type: gcp:compute:HealthCheck
properties:
name: http-health-check
description: Health check via http
timeoutSec: 1
checkIntervalSec: 1
healthyThreshold: 4
unhealthyThreshold: 5
httpHealthCheck:
portName: health-check-port
portSpecification: USE_NAMED_PORT
host: 1.2.3.4
requestPath: /mypath
proxyHeader: NONE
response: I AM HEALTHY
§Health Check Https
resources:
https-health-check:
type: gcp:compute:HealthCheck
properties:
name: https-health-check
timeoutSec: 1
checkIntervalSec: 1
httpsHealthCheck:
port: '443'
§Health Check Https Full
resources:
https-health-check:
type: gcp:compute:HealthCheck
properties:
name: https-health-check
description: Health check via https
timeoutSec: 1
checkIntervalSec: 1
healthyThreshold: 4
unhealthyThreshold: 5
httpsHealthCheck:
portName: health-check-port
portSpecification: USE_NAMED_PORT
host: 1.2.3.4
requestPath: /mypath
proxyHeader: NONE
response: I AM HEALTHY
§Health Check Http2
resources:
http2-health-check:
type: gcp:compute:HealthCheck
properties:
name: http2-health-check
timeoutSec: 1
checkIntervalSec: 1
http2HealthCheck:
port: '443'
§Health Check Http2 Full
resources:
http2-health-check:
type: gcp:compute:HealthCheck
properties:
name: http2-health-check
description: Health check via http2
timeoutSec: 1
checkIntervalSec: 1
healthyThreshold: 4
unhealthyThreshold: 5
http2HealthCheck:
portName: health-check-port
portSpecification: USE_NAMED_PORT
host: 1.2.3.4
requestPath: /mypath
proxyHeader: NONE
response: I AM HEALTHY
§Health Check Grpc
resources:
grpc-health-check:
type: gcp:compute:HealthCheck
properties:
name: grpc-health-check
timeoutSec: 1
checkIntervalSec: 1
grpcHealthCheck:
port: '443'
§Health Check Grpc Full
resources:
grpc-health-check:
type: gcp:compute:HealthCheck
properties:
name: grpc-health-check
timeoutSec: 1
checkIntervalSec: 1
grpcHealthCheck:
portName: health-check-port
portSpecification: USE_NAMED_PORT
grpcServiceName: testservice
§Health Check With Logging
resources:
health-check-with-logging:
type: gcp:compute:HealthCheck
properties:
name: tcp-health-check
timeoutSec: 1
checkIntervalSec: 1
tcpHealthCheck:
port: '22'
logConfig:
enable: true
§Compute Health Check Http Source Regions
resources:
http-health-check-with-source-regions:
type: gcp:compute:HealthCheck
properties:
name: http-health-check
checkIntervalSec: 30
httpHealthCheck:
port: 80
portSpecification: USE_FIXED_PORT
sourceRegions:
- us-west1
- us-central1
- us-east5
§Compute Health Check Https Source Regions
resources:
https-health-check-with-source-regions:
type: gcp:compute:HealthCheck
properties:
name: https-health-check
checkIntervalSec: 30
httpsHealthCheck:
port: 80
portSpecification: USE_FIXED_PORT
sourceRegions:
- us-west1
- us-central1
- us-east5
§Compute Health Check Tcp Source Regions
resources:
tcp-health-check-with-source-regions:
type: gcp:compute:HealthCheck
properties:
name: tcp-health-check
checkIntervalSec: 30
tcpHealthCheck:
port: 80
portSpecification: USE_FIXED_PORT
sourceRegions:
- us-west1
- us-central1
- us-east5
§Import
HealthCheck can be imported using any of these accepted formats:
-
projects/{{project}}/global/healthChecks/{{name}}
-
{{project}}/{{name}}
-
{{name}}
When using the pulumi import
command, HealthCheck can be imported using one of the formats above. For example:
$ pulumi import gcp:compute/healthCheck:HealthCheck default projects/{{project}}/global/healthChecks/{{name}}
$ pulumi import gcp:compute/healthCheck:HealthCheck default {{project}}/{{name}}
$ pulumi import gcp:compute/healthCheck:HealthCheck default {{name}}
Structs§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments