Skip to content

HealthCheck

Source: src/AWS/Route53/HealthCheck.ts

A Route 53 health check.

HealthCheck monitors the health of an endpoint and can gate failover and other routing policies on a Record via record.healthCheckId.

const check = yield* HealthCheck("ApiHealth", {
type: "HTTP",
fullyQualifiedDomainName: "api.example.com",
resourcePath: "/health",
port: 80,
requestInterval: "30 seconds",
failureThreshold: 3,
});
const check = yield* HealthCheck("PrimaryHealth", {
type: "HTTPS",
fullyQualifiedDomainName: "primary.example.com",
resourcePath: "/health",
port: 443,
});
// Route 53 answers with the PRIMARY record only while the check passes;
// see `Record` for the matching SECONDARY record.
const primary = yield* Record("Primary", {
hostedZoneId: zone.id,
name: "app.example.com",
type: "A",
ttl: "60 seconds",
records: ["1.2.3.4"],
setIdentifier: "primary",
failover: "PRIMARY",
healthCheckId: check.id,
});