
Use Case: You have a website to be accessible from all over the world. If you were running a business like a web shop, response time to the different geographical locations would be very critical.
Solution 1: One web server somewhere
Your customers in other regions would probably suffer from low latency. Would this web server handle all the workload from all over the world? What about high availability?
Solution 2: One server per continent with specific domain
You put one web server in each continent. How to handle the traffic to be forwarded to the next server? Would every continent host a different domain like myshop-europe.com and myshop-asia.com? People have to remember the specific domain for their region and you would have to make all domains popular! And you might not want to manage different domains!
Solution 3: One server per continent with one domain for all
- Single domain: only one popular domain you have to manage, e.g. myshop.com
- Automatic Traffic Management: customers’ requests are forwarded to the next server dependent on theirs’ geographical location
- High Availability: if one server fails, the traffic is forwarded to the next healthy one automatically
- Management: single web console or API to manage all the resources
Sounds great???
Implementation
As I don’t have a web shop, I’m going to put just a simple web page to display the words “Hello <your_continent>” and the Oracle Data Center is serving you. This would depends on your geographical location: visit hello.oci-solutions.com to check it out!
Africa: Hello Africa – from Zurich, as there is unfortunately no data center in Africa yet.
Asia: Hello Asia – from Mumbai
Europe: Hello Europe – from Frankfurt
North America: Hello North America – from Ashburn
Oceania: Hello Oceania – from Sydney
South America: Hello South America – from Sao Paulo
If not identifiable or you are in Antarctica: Hello World – from a second web server in Ashburn.
It is also possible to implement country specific rules as well instead of a whole continent.
Step 1: if you don’t have a domain, you could get one for less than 2$/year from different providers. As I’m passionate about Oracle Cloud technologies, I named mine oci-solutions.com
Step 2: use Oracle Cloud Infrastructure’s different regions all around the world: 11 by now and are growing and growing. You use one web console or API to manage all your resources and regions. Sign up for a new account and see how to extend your account to use all OCI Regions.
ALL resources used for this demo are part of my free trial! Try it out!!!
Step 3: create a Compute Instance in each region. Keep the default Oracle Linux OS. Each instance would have a different public IP address.
Step 4: Install a web server on each instance by executing the commands in this file.
Step 5: On each Compute Instance, save this simple HTML page (right click and “view page source”) in /var/www/html/index.html and change <continent_name> accordingly.
At this point you would have one web server for each continent accessible via a different public IP. Nothing special yet!!!
So let’s start with the magic and create only one domain name and let the traffic be automatically forwarded to each web server depending of the requestors’ location.
Step 6: from the OCI web console menu on the upper left side, click on “Networking”, “DNS Zone Management“. After entering your domain name you’ll get the Oracle DNS Nameservers displayed. Register these DNS Nameservers as custom nameservers at your domain provider. It could take up to 48 hours for this change to take effect.
Step 7: from the OCI web console menu on the upper left side, click on “Networking”, “Traffic Management Steering Policies“. Create an new policy and choose type “Geolocation Steering”. Create the answer pools (the IP addresses as A records), the steering rules, and a health check. Optionally create a subdomain.
That’s it!!!