Skip to content

How do I configure my website to fail over to an S3 bucket when a Route 53 health check fails?

4 minute read
0

I want to set up an Amazon Simple Storage Service (Amazon S3) bucket as a static endpoint that my Amazon Route 53 hosted zone can fail over to when there's an issue with my infrastructure.

Resolution

Configure a static website on Amazon S3

To configure an S3 bucket as a static endpoint for your Route 53 hosted zone to fail over to, see Tutorial: Configuring a static website on Amazon S3.

The static website is what you see when the hosted zone fails over. After your health check returns to healthy, the hosted zone automatically routes traffic to your primary endpoint in Amazon Elastic Compute Cloud (Amazon EC2). 

Note:

Create the Route 53 health check

Complete the following steps:

  1. Open the Amazon Route 53 console.
  2. In the navigation pane, choose Health checks.
  3. Choose Create health check, and then enter the following values: 
    For Name, enter a name for the health check.
    For What to monitor, choose Endpoint.
    For Specify endpoint by, choose IP address.
    For Protocol, choose HTTP.
    For IP address and Host name, enter the IP address and hostname for your EC2 instance. 
    For Port, choose 80.
    Keep Path empty, or specify the page that you want to check.
  4. Choose Next.
  5. For Create alarm, choose Yes.
  6. Choose Create health check.

Note: For more information, see Creating and updating health checks.

Create a record set for your primary endpoint

Complete the following steps:

  1. Open the Amazon Route 53 console.
  2. In the navigation pane, choose Hosted zones.
  3. For Domain name, choose the domain of the hosted zone that you want to create the record for.
  4. Choose Create record, and then create a record set with the following values: 
    For Record Name, enter the same name as your S3 bucket name.
    For Record type, choose A – Routes traffic to an IPV4 address and some AWS resources.
    For Alias, keep it Off.
    For Routing Policy, choose Failover.
    For Failover Record Type, choose Primary.
    For Record ID, enter a name.
    For Health check ID, select your health check.
    Enter other values for your use case.
  5. Choose Create records.

Create the failover endpoint

Complete the following steps:

  1. Open the Amazon Route 53 console.
  2. In the navigation pane, choose Hosted zones.
  3. Choose the hosted zone that you want to create the record for.
  4. Choose Create record, and then enter the following values:
    For Record name, use the same value that you entered for the primary record.
    For Record type, choose A – Routes traffic to an IPV4 address and some AWS resources.
    For Alias, choose Yes.
    Note: Aliases automatically use a time to live (TTL) that matches the alias target.
    Under Route traffic to, for Alias to S3 website endpoint, select your S3 bucket. 
    For Routing Policy, choose Failover.
    For Failover Record Type, choose Secondary.
    For Record ID, enter a name.
    Note: The name for the Record ID on your failover endpoint must be different from the name of the Record ID on your primary endpoint.
    (Optional) For Health check ID, choose a health check.
    (Optional) For Evaluate target health, turn off the option. When the target is an S3 bucket, the option doesn't work. For more information, see Failover routing.
  5. Choose Create records.

Related information

Choosing between alias and non-alias resource records

Configuring DNS failover

Monitoring health check status and getting notifications

5 Comments

I applied for the domain name Godaddy, which is bound to the DNS of AWS Global Accelerator, apache2 is configured with ssl, and my domain name is added to Route 53. The regional hosting settings failover to S3. Why is there an error 502 Bad Gateway? Is it bound to the DNS of AWS Global Accelerator? The reason is still the reason for the SSL configuration. How should I set it up to fail over to the S3 static website? AWS Global Accelerator connects to ALBs in different regions for cross-regional load balancing

replied 3 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
EXPERT
replied 3 years ago

After using CloudFront to serve HTTPS requests to my Amazon S3 bucket, should I still configure routing traffic to S3?

replied 3 years ago

When editing a Route53 record, the console does not have an Associate with Health Check. There is a Health check ID drop down list to select a Health check from.

replied 2 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
EXPERT
replied 2 years ago