I have a situation where we have a server at a remote location. Its connection to the internet (say on ip 184.108.40.206) can be flaky so we have a backup connection on a different provider (say via ip 220.127.116.11). The first provider is way more economical, but when it goes down we would like to connect to that server through the second provider, who will charge for bandwidth use. The second provider is much more reliable but way more expensive.
I need to have a DNS entry to the remote server that typically points to 18.104.22.168 but can change to 22.214.171.124 as an alternative when the connection is no good or some other way of directing clients in the city to that remote server that goes through either connection reliably and invisibly to the client.
How might I approach this?
It seems like it might be solvable at the DNS level, but not with any of the technology I am aware of. What else might work?