When a oracle database cloud instance is created, network access to the instance is limited to Secure Shell (SSH) connections on port 22. This access restriction ensures that the instance is secure by default.
You can either ask your cloud service administrator to open ports or, as you will learn in this tutorial, you can use SSH client software to create an SSH tunnel to connect securely to the database and its tools. Several SSH clients are freely available, including the SSH utility on Linux platforms and the PuTTY utility on Windows platforms. Here in this article we will concentrate on ssh tunnel with putty and check How to create a SSH tunnel in PuTTY to connect to Oracle database on Cloud
How do I create a SSH tunnel in PuTTY to connect to Oracle cloud database
We will see How do I create a SSH tunnel in PuTTY in details with clear steps. I am explaining with respect to Oracle database but it can be used in other stuff also
- First login to Oracle cloud service
you can go to http://cloud.oracle.com, click Sign In, and select the Public Cloud Services value for your region from the My Services – Select Data Center dropdown list. Either way you must provide an identity domain, user name, and password to sign in.
- Identify your service and click on it
- Make a note of the public IP address for the server
- Create SSH tunnel
Find putty.exe in the PuTTY folder on your computer, for example, C:\Program Files (x86)\PuTTY. Double-click putty.exe. to open it.
The PuTTY Configuration window is displayed, showing the Session panel.
In the Host Name (or IP address) box, enter the IP address of the VM. Leave the port number at the default 22 and Make sure connection type is SSH
In the Category tree, expand Connection if necessary and then click Data.
The Data panel is displayed.
In autologin, put OPC as the username
In the Category tree, click SSH.
The Options controlling SSH connections panel is displayed.
Under Protocol options, check Don’t start a shell command at all.
This optional step ensures that only the SSH tunnel is enabled. You will not be able to use the SSH session to run commands in the command shell (although you will be able to enter the passphrase for your SSH key, as prescribed later in this tutorial).
In the Category tree, expand SSH, and then click Auth.
In the Select private key file window, click PuTTY Private Key Files (.ppk) to find and open the private key file that matches the public key used when the instance was created.
In the Category tree, click Tunnels.
The Options controlling SSH port forwarding panel is displayed.
In the Destination box, enter database_server_ip:1521, where database_server_ip is the public IP address for the Database Server that you found and recorded earlier in this tutorial. Also select Local and Auto, if they aren’t already selected.
In the Source Port box, type 1521, to match the the VM’s port number.
Click Add to add the forwarded port. The local and remote ports appear in the Forwarded ports list.
In the Category tree, click Session. to display the Session panel again.
In the saved session ,type test_cloud to identify that setting and then save
Now we can use test_cloud anytime by selecting it and pressing the load button
Click Open to open the connection to the VM. If this is the first time you are connecting to the VM, the PuTTY Security Alert window is displayed, prompting you to confirm the public key.
Click Yes to continue connecting.
The PuTTY Configuration window closes and the PuTTY command window is displayed. The user name is the value you supplied earlier, in the Auto-login username box in step 5.
When prompted, enter the passphrase for the key, if one was defined.
Now the SSH tunnel is created