This sample project demonstrates how to create a Failover DNS record in Route 53 using a CDK application. It leverages the Route 53 Health Check feature to monitor the status of endpoints and automatically fail over to a backup endpoint in case of failure. Additionally, it configures SNS notifications to alert administrators when a failover event occurs, ensuring prompt awareness and response.
The architecture of this solution is illustrated in the following diagram:
The key components of the architecture are:
- Primary Endpoint: The main endpoint that serves traffic under normal circumstances.
- Secondary Endpoint: The backup endpoint that takes over traffic when the primary endpoint fails.
- Route 53 Hosted Zone: The DNS hosted zone where the Failover DNS record is created.
- Route 53 Health Checks: Health checks that monitor the availability of the primary and secondary endpoints.
- Route 53 Failover DNS Record: The DNS record that routes traffic to the primary endpoint by default, but automatically switches to the secondary endpoint when the primary endpoint fails the health check.
- SNS Topic: The Simple Notification Service (SNS) topic that publishes notifications when a failover event occurs.
- SNS Subscription: The subscription to the SNS topic, which can be configured to deliver notifications via email or other channels.
To get started with this project, follow these steps:
- Clone the repository.
- Install the required dependencies using
npm install. - Configure the necessary AWS credentials and environment variables.
- Select a Route 53 HostedZone that can be used for this project.
- Provide the required context values in the
cdk.jsonfile, includingdomainrefering the HostedZone,emailto get notifications,primaryRegion, andsecondaryRegionto deploy the sample application. - Deploy the CDK application using
cdk deploy.
Refer to the project's documentation for more detailed instructions and configuration options.
