I setup this website (www.s3post.cf) which uses a Node.js server to get this json file from CloudFront and display its content on the site.
The Cloudfront distribution uses this US EAST (N. Virginia) bucket (cloudfront.s3post.cf) as the origin. I will be creating a new bucket in US WEST (N. California) and enable cross-replication between the two buckets.
What I want to do is, when the US EAST bucket becomes unavailable, I need CloudFront to point to the backup bucket in US WEST. So basically an origin failover. How would I go about doing this?
I realize that I can code my application to failover to the backup bucket when the file becomes unavailable, but is there a way to get CloudFront to use another origin instead?
Also, is there a better way of doing this than what I have in mind with minimal downtime? I was able to use Route 53 for failover previously, but that was for a website being hosted statically on S3 without a backend server like in the current scenario.
P.S. - This is a test website that I setup to test failover scenarios.