Create Route53 HealthChecks to monitor TCP, HTTP, HTTPS endpoints, CloudWatch Alarms and other Route53 HealthChecks.
Project description
AWS CDK Route53 HealthCheck
Create Route53 HealthChecks to monitor TCP, HTTP, HTTPS endpoints, to monitor CloudWatch Alarms and to monitor other Route53 HealthChecks.
Currently supported types of Route53 HealthChecks:
- Health checks that monitor an endpoint
- Health checks that monitor other health checks
- Health checks that monitor CloudWatch alarms
- Configure DNS failover
Easily create a CloudWatch Alarm based on the Route53 HealthCheck:
const healthCheck = new EndpointHealthCheck(scope, "HealthCheck", {
domainName: "pepperize.com",
});
const alarm = new cloudwatch.Alarm(scope, "Alarm", {
metric: healthCheck.metricHealthCheckStatus(),
comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_THRESHOLD,
threshold: 1,
evaluationPeriods: 1,
});
See more options API Reference
Install
TypeScript
npm install @pepperize/cdk-route53-health-check
or
yarn add @pepperize/cdk-route53-health-check
Python
pip install pepperize.cdk-route53-health-check
C# / .Net
dotnet add package Pepperize.CDK.Route53HealthCheck
Java
<dependency>
<groupId>com.pepperize</groupId>
<artifactId>cdk-route53-health-check</artifactId>
<version>${cdkRoute53HealthCheck.version}</version>
</dependency>
Usage
npm install @pepperize/cdk-route53-health-check
See API.md.
HealthCheck for an endpoint
HTTPS health check
new EndpointHealthCheck(scope, "HealthCheck", {
domainName: "pepperize.com",
});
Generates
Resources:
Type: AWS::Route53::HealthCheck
Properties:
HealthCheckConfig:
FullyQualifiedDomainName: "pepperize.com"
Port: 443
Type: "HTTPS"
EnableSNI: true
Additional configuration options
new EndpointHealthCheck(scope, "HealthCheck", {
domainName: "pepperize.com", // The domain name that Route53 performs health checks on. Route53 resolves the IP address and performs the lookup.
enableSni: true, // Specify that Route53 sends the host name for TLS negotiation.
failureThreshold: 3, // The number of consecutive health checks that an endpoint must pass or fail for Route53 to change the current status of the endpoint between healthy and unhealthy.
healthCheckName: "pepperize.com", // The display name of this Route53 HealthCheck.
inverted: false, // Whether to invert the status of the Route53 health check status.
ipAddress: "1.1.1.1", // The ip address that Route53 performs health checks on. Optionally a domain name may be given.
latencyGraphs: true, // Whether Route53 measures the latency between health checkers in multiple AWS regions and your endpoint, and displays a CloudWatch latency graphs in the Route53 console.
port: 443, // The port that Route53 performs health checks.
protocol: Protocol.HTTPS, // The protocol that Route53 uses to communicate with the endpoint.
regions: [HealthCheckerRegions.EU_WEST_1, HealthCheckerRegions.US_EAST_1, HealthCheckerRegions.US_WEST_1], // The list of regions from which Route53 health checkers check the endpoint.
requestInterval: 30, // The number of seconds between the time that Route53 gets a response from your endpoint and the time that it sends the next health check request.
resourcePath: "/health-check", // The path for HTTP or HTTPS health checks.
searchString: "OK", // The search string for HTTP or HTTPS health checks.
});
See for more options API Reference - EndpointHealthCheckProps
HealthCheck to monitor other HealthChecks
const healthCheck1 = new EndpointHealthCheck(stack, "HealthCheck1", {
domainName: "pepperize.com",
});
const healthCheck2 = EndpointHealthCheck.fromHealthCheckId(
scope,
"HealthCheck2",
"9ebee2db-6292-4803-9838-327e6example"
);
new CalculatedHealthCheck(scope, "CalculatedHealthCheck", {
childHealthChecks: [healthCheck1, healthCheck2],
});
See for more options API Reference - CalculatedHealthCheckProps
HealthCheck to monitor CloudWatch Alarms
const alarm = cloudwatch.Alarm.fromAlarmArn(
scope,
"Alarm",
"arn:aws:cloudwatch:us-east-1:123456789012:alarm:any-alarm"
);
new AlarmHealthCheck(scope, "HealthCheck", {
alarm: alarm,
});
See for more options API Reference - AlarmHealthCheckProps
Configuring DNS Failover
An example active-passive DNS failover configuration
Primary
// An alias record set for a CloudFront distribution
const recordSetPrimary = new route53.ARecord(scope, "RecordSetPrimary", {
recordName: "www.pepperize.com",
zone: hostedZone,
target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)),
});
// The health check for the CloudFront distribution
const healthCheckPrimary = new EndpointHealthCheck(scope, "HealthCheckPrimary", {
domainName: "www.pepperize.com",
});
// Configure the HealthCheckId and Failover on the record set
healthCheckPrimary.failoverPrimary(recordSetPrimary);
Secondary
// An alias record set for an Application Load Balancer
const recordSetSecondary = new route53.ARecord(scope, "RecordSetSecondary", {
recordName: "www-1.pepperize.com",
zone: hostedZone,
target: route53.RecordTarget.fromAlias(new targets.LoadBalancerTarget(alb)),
});
// The health check for the Application Load Balancer
const healthCheckSecondary = new EndpointHealthCheck(scope, "HealthCheckSecondary", {
domainName: "www-1.pepperize.com",
});
// Configure the HealthCheckId and Failover on the record set
healthCheckSecondary.failoverSecondary(recordSetSecondary, true);
See for more options API Reference - IHealthCheck
How health checks work in complex Amazon Route 53 configurations
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pepperize.cdk-route53-health-check-0.0.512.tar.gz
.
File metadata
- Download URL: pepperize.cdk-route53-health-check-0.0.512.tar.gz
- Upload date:
- Size: 247.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3e10313a04f47378c12cc155b63f51306feeced2fdb09f3d0b6b9362c37b8cc |
|
MD5 | 1e5e1eca705a40836f0ba3aece4b7006 |
|
BLAKE2b-256 | 8f8fc9cc27bbda4cfa5d3d522a768f396998658a6c705e63ac101e48895022f7 |
File details
Details for the file pepperize.cdk_route53_health_check-0.0.512-py3-none-any.whl
.
File metadata
- Download URL: pepperize.cdk_route53_health_check-0.0.512-py3-none-any.whl
- Upload date:
- Size: 249.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc2ec1fe81635bf8b4d590b8c32819d5a480fddbeec18a8f6b0f42441b482796 |
|
MD5 | e5a9c24154b61123cbe5cb42a0f9d6cb |
|
BLAKE2b-256 | b333408cc060c66908b436f2e8c4e34e8d0c5cf4610cdae9e2ab6a39e1044aea |