[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
[![GitHub](https://img.shields.io/github/license/pepperize/cdk-route53-health-check?style=flat-square)](https://github.com/pepperize/cdk-route53-health-check/blob/main/LICENSE)
[![npm (scoped)](https://img.shields.io/npm/v/@pepperize/cdk-route53-health-check?style=flat-square)](https://www.npmjs.com/package/@pepperize/cdk-route53-health-check)
[![PyPI](https://img.shields.io/pypi/v/pepperize.cdk-route53-health-check?style=flat-square)](https://pypi.org/project/pepperize.cdk-route53-health-check/)
[![Nuget](https://img.shields.io/nuget/v/Pepperize.CDK.Route53HealthCheck?style=flat-square)](https://www.nuget.org/packages/Pepperize.CDK.Route53HealthCheck/)
[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.pepperize/cdk-route53-health-check?server=https%3A%2F%2Fs01.oss.sonatype.org%2F&style=flat-square)](https://s01.oss.sonatype.org/content/repositories/releases/com/pepperize/cdk-route53-health-check/)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/pepperize/cdk-route53-health-check/release.yml?branch=main&label=release&style=flat-square)](https://github.com/pepperize/cdk-route53-health-check/actions/workflows/release.yml)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/pepperize/cdk-route53-health-check?sort=semver&style=flat-square)](https://github.com/pepperize/cdk-route53-health-check/releases)
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/pepperize/cdk-route53-health-check)
# 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](https://github.com/pepperize/cdk-route53-health-check#healthcheck-for-an-endpoint)
* [Health checks that monitor other health checks](https://github.com/pepperize/cdk-route53-health-check#healthcheck-to-monitor-cloudwatch-alarms)
* [Health checks that monitor CloudWatch alarms](https://github.com/pepperize/cdk-route53-health-check#healthcheck-to-monitor-other-healthchecks)
* [Configure DNS failover](https://github.com/pepperize/cdk-route53-health-check#configuring-dns-failover)
Easily create a CloudWatch Alarm based on the Route53 HealthCheck:
```python
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](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md#@pepperize/cdk-route53-health-check.EndpointHealthCheckProps)
## Install
### TypeScript
```shell
npm install @pepperize/cdk-route53-health-check
```
or
```shell
yarn add @pepperize/cdk-route53-health-check
```
### Python
```shell
pip install pepperize.cdk-route53-health-check
```
### C# / .Net
```
dotnet add package Pepperize.CDK.Route53HealthCheck
```
### Java
```xml
<dependency>
<groupId>com.pepperize</groupId>
<artifactId>cdk-route53-health-check</artifactId>
<version>${cdkRoute53HealthCheck.version}</version>
</dependency>
```
## Usage
```shell
npm install @pepperize/cdk-route53-health-check
```
See [API.md](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md).
### HealthCheck for an endpoint
**HTTPS health check**
```python
new EndpointHealthCheck(scope, "HealthCheck", {
domainName: "pepperize.com",
});
```
Generates
```yaml
Resources:
Type: AWS::Route53::HealthCheck
Properties:
HealthCheckConfig:
FullyQualifiedDomainName: "pepperize.com"
Port: 443
Type: "HTTPS"
EnableSNI: true
```
**Additional configuration options**
```python
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](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md#endpointhealthcheckprops-)
### HealthCheck to monitor other HealthChecks
```python
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](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md#calculatedhealthcheckprops-)
### HealthCheck to monitor CloudWatch Alarms
```python
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](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md#alarmhealthcheckprops-)
### Configuring DNS Failover
An example active-passive DNS failover configuration
![DNS failover](https://github.com/pepperize/cdk-route53-health-check/blob/main/diagram.png)
**Primary**
```python
// 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**
```python
// 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](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md#ihealthcheck-)
[How health checks work in complex Amazon Route 53 configurations](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-complex-configs.html)
Raw data
{
"_id": null,
"home_page": "https://github.com/pepperize/cdk-route53-health-check.git",
"name": "pepperize.cdk-route53-health-check",
"maintainer": "",
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Patrick Florek<patrick.florek@gmail.com>",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/8f/8f/c9cc27bbda4cfa5d3d522a768f396998658a6c705e63ac101e48895022f7/pepperize.cdk-route53-health-check-0.0.512.tar.gz",
"platform": null,
"description": "[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)\n[![GitHub](https://img.shields.io/github/license/pepperize/cdk-route53-health-check?style=flat-square)](https://github.com/pepperize/cdk-route53-health-check/blob/main/LICENSE)\n[![npm (scoped)](https://img.shields.io/npm/v/@pepperize/cdk-route53-health-check?style=flat-square)](https://www.npmjs.com/package/@pepperize/cdk-route53-health-check)\n[![PyPI](https://img.shields.io/pypi/v/pepperize.cdk-route53-health-check?style=flat-square)](https://pypi.org/project/pepperize.cdk-route53-health-check/)\n[![Nuget](https://img.shields.io/nuget/v/Pepperize.CDK.Route53HealthCheck?style=flat-square)](https://www.nuget.org/packages/Pepperize.CDK.Route53HealthCheck/)\n[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.pepperize/cdk-route53-health-check?server=https%3A%2F%2Fs01.oss.sonatype.org%2F&style=flat-square)](https://s01.oss.sonatype.org/content/repositories/releases/com/pepperize/cdk-route53-health-check/)\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/pepperize/cdk-route53-health-check/release.yml?branch=main&label=release&style=flat-square)](https://github.com/pepperize/cdk-route53-health-check/actions/workflows/release.yml)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/pepperize/cdk-route53-health-check?sort=semver&style=flat-square)](https://github.com/pepperize/cdk-route53-health-check/releases)\n[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/pepperize/cdk-route53-health-check)\n\n# AWS CDK Route53 HealthCheck\n\nCreate Route53 HealthChecks to monitor TCP, HTTP, HTTPS endpoints, to monitor CloudWatch Alarms and to monitor other Route53 HealthChecks.\n\nCurrently supported types of Route53 HealthChecks:\n\n* [Health checks that monitor an endpoint](https://github.com/pepperize/cdk-route53-health-check#healthcheck-for-an-endpoint)\n* [Health checks that monitor other health checks](https://github.com/pepperize/cdk-route53-health-check#healthcheck-to-monitor-cloudwatch-alarms)\n* [Health checks that monitor CloudWatch alarms](https://github.com/pepperize/cdk-route53-health-check#healthcheck-to-monitor-other-healthchecks)\n* [Configure DNS failover](https://github.com/pepperize/cdk-route53-health-check#configuring-dns-failover)\n\nEasily create a CloudWatch Alarm based on the Route53 HealthCheck:\n\n```python\nconst healthCheck = new EndpointHealthCheck(scope, \"HealthCheck\", {\n domainName: \"pepperize.com\",\n});\n\nconst alarm = new cloudwatch.Alarm(scope, \"Alarm\", {\n metric: healthCheck.metricHealthCheckStatus(),\n comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_THRESHOLD,\n threshold: 1,\n evaluationPeriods: 1,\n});\n```\n\nSee more options [API Reference](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md#@pepperize/cdk-route53-health-check.EndpointHealthCheckProps)\n\n## Install\n\n### TypeScript\n\n```shell\nnpm install @pepperize/cdk-route53-health-check\n```\n\nor\n\n```shell\nyarn add @pepperize/cdk-route53-health-check\n```\n\n### Python\n\n```shell\npip install pepperize.cdk-route53-health-check\n```\n\n### C# / .Net\n\n```\ndotnet add package Pepperize.CDK.Route53HealthCheck\n```\n\n### Java\n\n```xml\n<dependency>\n <groupId>com.pepperize</groupId>\n <artifactId>cdk-route53-health-check</artifactId>\n <version>${cdkRoute53HealthCheck.version}</version>\n</dependency>\n```\n\n## Usage\n\n```shell\nnpm install @pepperize/cdk-route53-health-check\n```\n\nSee [API.md](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md).\n\n### HealthCheck for an endpoint\n\n**HTTPS health check**\n\n```python\nnew EndpointHealthCheck(scope, \"HealthCheck\", {\n domainName: \"pepperize.com\",\n});\n```\n\nGenerates\n\n```yaml\nResources:\n Type: AWS::Route53::HealthCheck\n Properties:\n HealthCheckConfig:\n FullyQualifiedDomainName: \"pepperize.com\"\n Port: 443\n Type: \"HTTPS\"\n EnableSNI: true\n```\n\n**Additional configuration options**\n\n```python\nnew EndpointHealthCheck(scope, \"HealthCheck\", {\n domainName: \"pepperize.com\", // The domain name that Route53 performs health checks on. Route53 resolves the IP address and performs the lookup.\n enableSni: true, // Specify that Route53 sends the host name for TLS negotiation.\n 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.\n healthCheckName: \"pepperize.com\", //\tThe display name of this Route53 HealthCheck.\n inverted: false, // Whether to invert the status of the Route53 health check status.\n ipAddress: \"1.1.1.1\", // The ip address that Route53 performs health checks on. Optionally a domain name may be given.\n 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.\n port: 443, // The port that Route53 performs health checks.\n protocol: Protocol.HTTPS, // The protocol that Route53 uses to communicate with the endpoint.\n 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.\n 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.\n resourcePath: \"/health-check\", // The path for HTTP or HTTPS health checks.\n searchString: \"OK\", // The search string for HTTP or HTTPS health checks.\n});\n```\n\nSee for more options [API Reference - EndpointHealthCheckProps](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md#endpointhealthcheckprops-)\n\n### HealthCheck to monitor other HealthChecks\n\n```python\nconst healthCheck1 = new EndpointHealthCheck(stack, \"HealthCheck1\", {\n domainName: \"pepperize.com\",\n});\nconst healthCheck2 = EndpointHealthCheck.fromHealthCheckId(\n scope,\n \"HealthCheck2\",\n \"9ebee2db-6292-4803-9838-327e6example\"\n);\nnew CalculatedHealthCheck(scope, \"CalculatedHealthCheck\", {\n childHealthChecks: [healthCheck1, healthCheck2],\n});\n```\n\nSee for more options [API Reference - CalculatedHealthCheckProps](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md#calculatedhealthcheckprops-)\n\n### HealthCheck to monitor CloudWatch Alarms\n\n```python\nconst alarm = cloudwatch.Alarm.fromAlarmArn(\n scope,\n \"Alarm\",\n \"arn:aws:cloudwatch:us-east-1:123456789012:alarm:any-alarm\"\n);\nnew AlarmHealthCheck(scope, \"HealthCheck\", {\n alarm: alarm,\n});\n```\n\nSee for more options [API Reference - AlarmHealthCheckProps](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md#alarmhealthcheckprops-)\n\n### Configuring DNS Failover\n\nAn example active-passive DNS failover configuration\n\n![DNS failover](https://github.com/pepperize/cdk-route53-health-check/blob/main/diagram.png)\n\n**Primary**\n\n```python\n// An alias record set for a CloudFront distribution\nconst recordSetPrimary = new route53.ARecord(scope, \"RecordSetPrimary\", {\n recordName: \"www.pepperize.com\",\n zone: hostedZone,\n target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)),\n});\n// The health check for the CloudFront distribution\nconst healthCheckPrimary = new EndpointHealthCheck(scope, \"HealthCheckPrimary\", {\n domainName: \"www.pepperize.com\",\n});\n// Configure the HealthCheckId and Failover on the record set\nhealthCheckPrimary.failoverPrimary(recordSetPrimary);\n```\n\n**Secondary**\n\n```python\n// An alias record set for an Application Load Balancer\nconst recordSetSecondary = new route53.ARecord(scope, \"RecordSetSecondary\", {\n recordName: \"www-1.pepperize.com\",\n zone: hostedZone,\n target: route53.RecordTarget.fromAlias(new targets.LoadBalancerTarget(alb)),\n});\n// The health check for the Application Load Balancer\nconst healthCheckSecondary = new EndpointHealthCheck(scope, \"HealthCheckSecondary\", {\n domainName: \"www-1.pepperize.com\",\n});\n// Configure the HealthCheckId and Failover on the record set\nhealthCheckSecondary.failoverSecondary(recordSetSecondary, true);\n```\n\nSee for more options [API Reference - IHealthCheck](https://github.com/pepperize/cdk-route53-health-check/blob/main/API.md#ihealthcheck-)\n\n[How health checks work in complex Amazon Route 53 configurations](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-complex-configs.html)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Create Route53 HealthChecks to monitor TCP, HTTP, HTTPS endpoints, CloudWatch Alarms and other Route53 HealthChecks.",
"version": "0.0.512",
"project_urls": {
"Homepage": "https://github.com/pepperize/cdk-route53-health-check.git",
"Source": "https://github.com/pepperize/cdk-route53-health-check.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b333408cc060c66908b436f2e8c4e34e8d0c5cf4610cdae9e2ab6a39e1044aea",
"md5": "e5a9c24154b61123cbe5cb42a0f9d6cb",
"sha256": "cc2ec1fe81635bf8b4d590b8c32819d5a480fddbeec18a8f6b0f42441b482796"
},
"downloads": -1,
"filename": "pepperize.cdk_route53_health_check-0.0.512-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e5a9c24154b61123cbe5cb42a0f9d6cb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 249077,
"upload_time": "2023-12-28T13:08:34",
"upload_time_iso_8601": "2023-12-28T13:08:34.482963Z",
"url": "https://files.pythonhosted.org/packages/b3/33/408cc060c66908b436f2e8c4e34e8d0c5cf4610cdae9e2ab6a39e1044aea/pepperize.cdk_route53_health_check-0.0.512-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8f8fc9cc27bbda4cfa5d3d522a768f396998658a6c705e63ac101e48895022f7",
"md5": "1e5e1eca705a40836f0ba3aece4b7006",
"sha256": "b3e10313a04f47378c12cc155b63f51306feeced2fdb09f3d0b6b9362c37b8cc"
},
"downloads": -1,
"filename": "pepperize.cdk-route53-health-check-0.0.512.tar.gz",
"has_sig": false,
"md5_digest": "1e5e1eca705a40836f0ba3aece4b7006",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 247680,
"upload_time": "2023-12-28T13:08:40",
"upload_time_iso_8601": "2023-12-28T13:08:40.643907Z",
"url": "https://files.pythonhosted.org/packages/8f/8f/c9cc27bbda4cfa5d3d522a768f396998658a6c705e63ac101e48895022f7/pepperize.cdk-route53-health-check-0.0.512.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-28 13:08:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pepperize",
"github_project": "cdk-route53-health-check",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pepperize.cdk-route53-health-check"
}