How to make Rackspace Cloud Database publicly available for remote connection?

Rackspace CloudDB are great things for small/medium sized business, but there can be few instances where you want to test it out first without actually having the hassle of creating another server and moving all code files there. I for instance would certainly like to test it out by simply editing the database configurations on development environment before taking the hassle of moving everything from current host to new host.

CloudDB is only available on Rackspace local network:

This is a problem when you need to connect CloudDB to a server, which is outside Rackspace network. There is a work around for this. Let me explain that to you step by step.

1. On Rackspace cloud control panel, click on Databases.
2. Then click on ‘Create MySQL instance’ button to view the following screen.

rackspace-cloud1

3. Fill in the information for DB instance as per your hardware requirements and add a database. Adding a database part is optional, as you can always create it later.
4. Click on ‘Create Instance’ button.
5. Instance is created and available for your use, but this is only available for use within Rackspace network.
6. Now you want to make it available for outside network App server (If your App is with another host)
7. Note down the host name of your db instance as shown in below screenshot.

rackspace-cloud2

8. This is hostname, which is used to connect to this DB from any local Rackspace Server in the same datacenter.
9. Now click on Load Balancer tab in the top bar.
10. Click on ‘Create Load Balancer’ button to see the following screen.

creating-load-balancer

11. In the virtual IP dropdown, select Accessible on the Public Internet.
12. Change the Protocol / Port to ‘Mysql’ / 3306.
13. Make sure you create the Load balancer in the same ‘Region’ or Datacenter where you have created the CloudDB.
14. Now scroll down to view following options.

add-nodes

15. Here click on ‘Add External Node’ button, to view following options.

add-external-node

16. In IP or Hostname, copy Paste the hostname of your CloudDB which you noted in Step#7.
17. For DB, set the port as 3306 (MySQL port)
18. Click on ‘Add External Node’, external node of cloudDB is added to your load balancer.
19. If you receive an error while adding an external node like ‘ The address is not a valid IPV4, IPV6 address’ that means the newly created CloudDB host is not propagated yet, just wait for 5-10 minutes and try again. Also if you don’t want to wait, you can simply contact Rackspace Support on live chat and give the CloudDB hostname and ask Private IP of your instance.
20. Click on Create Load Balancer button, A load balancer is created and connected to your CloudDB.
21. Now You can see (screenshot below) the load balancer IP address which is publicly available and use it to connect to your CloudDB from any computer in the world using the database credentials which you created.

load-balancer-details