Package: pepperize.cdk-route53-health-check
AWS CDK Route53 HealthCheckCreate 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 endpointHealth checks that monitor other health checksHealth checks that monitor CloudWatch alarmsConfigure DNS failoverEasily create a CloudWatch Alarm based on the Route53 HealthCheck:consthealthCheck=newEndpointHealthCheck(scope,"HealthCheck",{domainName:"pepperize.com",});constalarm=newcloudwatch.Alarm(scope,"Alarm",{metric:healthCheck.metricHealthCheckStatus(),comparisonOperator:cloudwatch.ComparisonOperator.LESS_THAN_THRESHOLD,threshold:1,evaluationPeriods:1,});See more optionsAPI ReferenceInstallTypeScriptnpminstall@pepperize/cdk-route53-health-checkoryarnadd@pepperize/cdk-route53-health-checkPythonpipinstallpepperize.cdk-route53-health-checkC# / .Netdotnet add package Pepperize.CDK.Route53HealthCheckJava<dependency><groupId>com.pepperize</groupId><artifactId>cdk-route53-health-check</artifactId><version>${cdkRoute53HealthCheck.version}</version></dependency>Usagenpminstall@pepperize/cdk-route53-health-checkSeeAPI.md.HealthCheck for an endpointHTTPS health checknewEndpointHealthCheck(scope,"HealthCheck",{domainName:"pepperize.com",});GeneratesResources:Type:AWS::Route53::HealthCheckProperties:HealthCheckConfig:FullyQualifiedDomainName:"pepperize.com"Port:443Type:"HTTPS"EnableSNI:trueAdditional configuration optionsnewEndpointHealthCheck(scope,"HealthCheck",{domainName:"pepperize.com",//ThedomainnamethatRoute53performshealthcheckson.Route53resolvestheIPaddressandperformsthelookup.enableSni:true,//SpecifythatRoute53sendsthehostnameforTLSnegotiation.failureThreshold:3,//ThenumberofconsecutivehealthchecksthatanendpointmustpassorfailforRoute53tochangethecurrentstatusoftheendpointbetweenhealthyandunhealthy.healthCheckName:"pepperize.com",//ThedisplaynameofthisRoute53HealthCheck.inverted:false,//WhethertoinvertthestatusoftheRoute53healthcheckstatus.ipAddress:"1.1.1.1",//TheipaddressthatRoute53performshealthcheckson.Optionallyadomainnamemaybegiven.latencyGraphs:true,//WhetherRoute53measuresthelatencybetweenhealthcheckersinmultipleAWSregionsandyourendpoint,anddisplaysaCloudWatchlatencygraphsintheRoute53console.port:443,//TheportthatRoute53performshealthchecks.protocol:Protocol.HTTPS,//TheprotocolthatRoute53usestocommunicatewiththeendpoint.regions:[HealthCheckerRegions.EU_WEST_1,HealthCheckerRegions.US_EAST_1,HealthCheckerRegions.US_WEST_1],//ThelistofregionsfromwhichRoute53healthcheckerschecktheendpoint.requestInterval:30,//ThenumberofsecondsbetweenthetimethatRoute53getsaresponsefromyourendpointandthetimethatitsendsthenexthealthcheckrequest.resourcePath:"/health-check",//ThepathforHTTPorHTTPShealthchecks.searchString:"OK",//ThesearchstringforHTTPorHTTPShealthchecks.});See for more optionsAPI Reference - EndpointHealthCheckPropsHealthCheck to monitor other HealthChecksconsthealthCheck1=newEndpointHealthCheck(stack,"HealthCheck1",{domainName:"pepperize.com",});consthealthCheck2=EndpointHealthCheck.fromHealthCheckId(scope,"HealthCheck2","9ebee2db-6292-4803-9838-327e6example");newCalculatedHealthCheck(scope,"CalculatedHealthCheck",{childHealthChecks:[healthCheck1,healthCheck2],});See for more optionsAPI Reference - CalculatedHealthCheckPropsHealthCheck to monitor CloudWatch Alarmsconstalarm=cloudwatch.Alarm.fromAlarmArn(scope,"Alarm","arn:aws:cloudwatch:us-east-1:123456789012:alarm:any-alarm");newAlarmHealthCheck(scope,"HealthCheck",{alarm:alarm,});See for more optionsAPI Reference - AlarmHealthCheckPropsConfiguring DNS FailoverAn example active-passive DNS failover configurationPrimary//AnaliasrecordsetforaCloudFrontdistributionconstrecordSetPrimary=newroute53.ARecord(scope,"RecordSetPrimary",{recordName:"www.pepperize.com",zone:hostedZone,target:route53.RecordTarget.fromAlias(newtargets.CloudFrontTarget(distribution)),});//ThehealthcheckfortheCloudFrontdistributionconsthealthCheckPrimary=newEndpointHealthCheck(scope,"HealthCheckPrimary",{domainName:"www.pepperize.com",});//ConfiguretheHealthCheckIdandFailoverontherecordsethealthCheckPrimary.failoverPrimary(recordSetPrimary);Secondary//AnaliasrecordsetforanApplicationLoadBalancerconstrecordSetSecondary=newroute53.ARecord(scope,"RecordSetSecondary",{recordName:"www-1.pepperize.com",zone:hostedZone,target:route53.RecordTarget.fromAlias(newtargets.LoadBalancerTarget(alb)),});//ThehealthcheckfortheApplicationLoadBalancerconsthealthCheckSecondary=newEndpointHealthCheck(scope,"HealthCheckSecondary",{domainName:"www-1.pepperize.com",});//ConfiguretheHealthCheckIdandFailoverontherecordsethealthCheckSecondary.failoverSecondary(recordSetSecondary,true);See for more optionsAPI Reference - IHealthCheckHow health checks work in complex Amazon Route 53 configurations