简体   繁体   中英

How can we do failover to another custom origin using cloudfront-my both origins are ALB

I have one ALB as my origin(primary one) but I want to failover to second ALB in case first goes down.

ex: Primary is abc.amazon.com (first ALB) and I want to failover to second one (xyz.amazon.com).

I created the origin group and behaviour(putting path for failover ALB as /, not sure if this one is correct way).

Kindly suggest.

  1. Create two origins (PATH is not required in origin config as cloudfront is going to append it with every request before contact to the origin )

  2. Create Origin group, define primary and secondary.

  3. In cache behaviour, choose Origin group

You can configure CloudFront to failover to secondary if origin serves the response code you mentioned in the origin group configuration. In case cloudfront isn't connect to origin and serves 504 by itself, it'll also failover to the secondary.

Note: please note that failover doesn't mean cloudfront will send all the subsequent requests to secondary , it works as per request level, request comes to cloudfront and it connects to primary , if it fails , fallback to the secondary , next request comes, the same cycles happens again. (caching helps for same content)

You may need to make an API call to change origin group config to make the other one primary because in case of 504 and if your origin response timeout is configured high, you'll see lot of delay using origin failover.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM