CDK and Route 53 Failover
We found a quite useful CDK article. It’s using a Lambda, Route 53 “A record”, and more. It’s titled “AWS CDK: Use Lambda with Application Load Balancer” https://sbstjn.com/blog/aws-cdk-lambda-loadbalancer-vpc-certificate/
However, the article does not cover failover. The straight forward question would be “what changes to this article would be made so that Active-passive failover between regions is supported?“
I understand a Route 53 “A record” has the "Failover routing policy" with which one can set up an active-passive failover setup. Hypothetically: if us-east-1 is down, it would automatically switch us to us-east-2.
Items of note:
- Unless I missed it, the latest CDK ARecord (2.10.0) does not seem to support configuring the ARecord for failover. https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53.ARecord.html
- I see that the ability to set the routing policy for an ARecord was requested in 2019 https://github.com/aws/aws-cdk/issues/4391 which would cover a superset of what we need. The comments mention using CfnRecordSet. Is that currently the best way?
- Top level concepts from the article are: Lambda with handler code, LambdaTarget, ApplicationLoadBalancer, Certificate, and Route-53-A-Record (IPv4 DNS).
Other related resources:
- https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html
- https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-configuring.html
- https://aws.amazon.com/blogs/networking-and-content-delivery/lambda-functions-as-targets-for-application-load-balancers/
Any insight into how to implement failover using CDK, would be quite welcome. Thanks!
Update Feb 5, 2022
Still hoping for an optimal solution. For now, trying to wrestle with CfnRecordSet. CfnRecordSet properties of setIdentifier, aliasTarget with evaluateTargetHealth (Evaluate Target Health), and failover seem to be key.
Evaluate Target Health related docs that we are looking at:
- Route 53 RecordSet "Evaluate Target Health" via CloudFormation template
- which points at https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-aliastarget
- and points at https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html#cfn-route53-aliastarget-evaluatetargethealth
Relevant questions
How to add python libraries to lambda using the CDK?
Accepted Answerasked 2 years agoWill Route 53-with-Failover Based on CloudWatch Work With A Private API-Gateway REST-API?
asked 5 months agoAsset Parameters in Cloud Formation template generated by AWS CDK
asked 2 months agoRoute53 used as sceondary DNS server
Accepted Answerasked 4 years agoPrivate Route 53 to API Gateway
Accepted Answerasked 5 months agoCDK and Route 53 Failover
asked 4 months agoHow to allign the Name Servers of Route53 Public Hosted Zone and Registered Domains in CDK?
asked 4 months agoIs AthenaDynamoDBConnector available for CDK
asked 2 months agoHow to connect a Load balancer and an Interface VPC Endpoint together using CDK?
Accepted Answerasked 4 months agoHow to use AWS CDK to compile and deploy a typescript api with dependencies to lambda?
asked 4 months ago