Temporary invert primary <=> secondary on AWS Route53 DNS Failover setup - amazon-web-services

I have a Route53 DNS Failover setup associated with Health Checks running fine but periodically we need to invert primary <=> secondary just for an hour or two for maintenance.
How is the best practice for this? Any simple way to achieve that?
Any input is appreciated!!
Best regards,

I'm not sure if it's best practice but you can do the following.
mysite.example.com failover (primary) (evaluate target health + cacluated health check attached) --> site1.example.com (associated with regular hc)
mysite.example.com failover (secondary) (evaluate target health + cacluated health check attached) --> site2.example.com (associated with regular hc)
You can create two calculated health checks with no children. Associate the health checks with each site. If the child health check (site1) becomes unhealthy, Route 53 to failover to site2. If you invert the status of your calculated health check, Route 53 will then failover to site 2. When you are down, uninvert the health check.

Related

Route53 health check shows OK while the endpoint is down

I'm not sure how it's possible, but I set up a Route 53 health check with email alerting if our endpoint goes down.
It is definitely down because the EC2 hosting it is powered off.
❯ telnet foo.io 443
Trying 18.18.18.18...
telnet: connect to address 18.18.18.18: Operation timed out
telnet: Unable to connect to remote host
Is it possible that the checker has cached something? Although we don't use anything in between and it's supposed to hit the EC2 directly.
I think you have left your health check disabled
That's what the doc states
Stops Route 53 from performing health checks. When you disable a health check, Route 53 stops aggregating the status of the referenced health checks.
After you disable a health check, Route 53 considers the status of the health check to always be healthy. If you configured DNS failover, Route 53 continues to route traffic to the corresponding resources.
Maybe that's why you see it passing

what happens when health check fails in weighted policy on route 53?

I am wondering what happens when I have a weighted routing policy set up in my rout53 pointing at two different Ec2 or ALB and the health check fails for one of them?
What happens to the traffic which is on the failed weight target?
Will it fail? or route53 will send that weight also to the healthy target which will exceed the original weight assigned to the healthy targets.
TL;DR, it will ignore the unhealthy endpoint and re-calculate the weight.
For example, if you have 3 endpoints with a weight 1 for each of them. Normally, you will get 1/3 of the total traffic on each endpoint. If one of them fails the health check, then the remaining two healthy endpoints will each receive 1/2 of the total traffic.

http load balancer and health check

I found this question..
You want to configure autohealing for network load balancing for a group of Compute Engine instances that run in multiple zones, using the fewest possible steps. You need to configure recreation of VMs if they are unresponsive after 3 attempts of 10 seconds each. What should you do?
A. Create an HTTP load balancer with a backend configuration that references an existing instance group. Set the health check to healthy(HTTP)
B. Create an HTTP load balancer with a backend configuration that references an existing instance group. Define a balancing mode and set the maximum RPS to 10.
C. Create a managed instance group. Set the Autohealing health check to healthy(HTTP)
D. Create a managed instance group. Verify that the auto scaling setting is on.
Which is the correct answer? I think is A
To configure the recreation of VMs, you need Autohealing. So not B and D.
A: Load balancing health checks help direct traffic away from non-responsive instances and toward healthy instances; these health checks do not cause Compute Engine to recreate instances.
C: Application-based autohealing improves application availability by relying on a health checking signal that detects application-specific issues such as freezing, crashing, or overloading. If a health check determines that an application has failed on an instance, the group automatically recreates that instance.
So the answer is C.
You want to configure autohealing for network load balancing for a
group of Compute Engine instances that run in multiple zones, using
the fewest possible steps. You need to configure recreation of VMs if
they are unresponsive after 3 attempts of 10 seconds each. What should
you do?
Let's analyze each possible answer to determine the best answer. Note that this question has a key phrase "using the fewest possible steps". This phrase will bias selecting the best answer.
A. Create an HTTP load balancer with a backend configuration that
references an existing instance group. Set the health check to
healthy(HTTP)
This is a possible answer. This answer assumes that the existing backend is configured correctly.
B. Create an HTTP load balancer with a backend configuration that
references an existing instance group. Define a balancing mode and set
the maximum RPS to 10.
This is a possible answer. This answer assumes that the existing backend is configured correctly. This answer adds an additional step over answer A.
C. Create a managed instance group. Set the Autohealing health check
to healthy(HTTP)
This is only a partial solution. The default configuration is auto scaling enabled. You still need to create the HTTP Load Balancer.
D. Create a managed instance group. Verify that the auto scaling
setting is on.
This is only a partial solution. Creating a Managed Instance Group with Auto Scaling is required, but you still need to create the HTTP Load Balancer.
Drumroll Please ....
Therefore the best answer is A in my opinion.

Health check in aws route53

Q1.)While creating a record using failover-policy in route53-hosted-zone :
What is the difference between "evaluate-target-health" and "associate-health-check" ?
Q2.)Does route53 perform health check for EACH dns-request it receives ?
Both basically do the same thing. The key difference is that Evaluate Target Health is used with ALIAS records, e.g. a load balancer DNS endpoint and Associate with Health Check is used with A records, e.g. a web server's static IP address.
Evaluate Target Health does not use a health check that you create. Associate with Health Check uses a health check that you create.
Another way to compare the differences. Use Evaluate Target Health for an AWS service that manages its health status. Use Associate Health check for a service that you control and determine its health status thru your own health check.
Answer for your 1st question is already given by John Hanley. The answer for your 2nd question is NO.
According to AWS Documentation,
"If you associated a health check with a non-alias record, Route 53 checks the current status of the health check.
Route 53 periodically checks the health of the endpoint that is specified in a health check; it doesn't perform the health check when the DNS query arrives."
I hope that answers your question :)

Route 53 failover routing takes downtime of 6 to 8 minutes

I am getting "502 bad gateway error" between switching regions of Route 53 Failover.
Switching between primary to secondary takes 2-3 minutes if primary is down.
Meanwhile when on DR site IF primary comes up It will takes another 6 to 8 minutes for redirecting traffic from DR to primary. How to completely minimizes downtime from 6 to 8 minutes to 0?
You need to check how long it takes your ELB Health Check + Route53 Health Checks to determine a failover is required, the final step is the TTL of the DNS records.
For example, let's say you have a web application, hosted behind and ELB, and you are accessing it via myapp.mydomain.com.
ELB Health Check
While the primary thing you should check is the R53 health check (see below), the ELB configuration is also important.
Look at how long it should take to determine failure:
HealthCheck Interval - The amount of time between health checks
Unhealthy Threshold - How many failed health checks
Make sure this configuration is the same in ELBs in both regions.
Route53 Health Check
This is the main thing that will determine how long failover takes.
You probably have 2 CNAME records for myapp.mydomain.com, each pointing to a R53 health check, and each health check points at an ELB at it's respective region.
Check both health checks and make sure:
Request interval - How often R53 will poll your ELB for it's health.
Failure threshold - The number of consecutive health checks that an endpoint must pass or fail for the status to change.
Make sure both health check's config (Primary and Secondary) are the same.
Once the status changes, it's up to the DNS record TTL.
Route53 CNAME TTL
Check how long your CNAMES will point to a record after a failover by looking at the record TTL. For example, if TTL is 30, it will take approx. 30 seconds for Route53 to start pointing to the secondary region.
Make sure both CNAME records have the same TTL.
After following this you can determine how long it should take to failover, for example:
Your health checks are looking at port 80:/ availability, your health checks take approx. 30 seconds, and your apache dies on the primary site.
Within 30 (example) seconds ELB will determine instances out of service and stop forwarding traffic.
Within the same 30 (example) seconds the R53 health check which is monitoring the same healthcheck (port 80:/) will also determine primary ELB is unhealthy.
This is where R53 decides to start pointing DNS queries to your secondary ELB.
If your TTL is set to 30, failover should be completed in approx. 1 minute, +/- some time for propagation, etc.
Make sure not to set your health checks to be too frequent, depending on how many instances are behind your ELB, it can result in a lot of calls to your service from the ELB and Route53 for the health endpoint.