A virtual cloud network (VCN) is a virtual, private network you set up in Oracle data centers. It is very similar to a traditional network with firewall rules and various gateways. When you work with Oracle Cloud Infrastructure (OCI), setting up a VCN for your cloud resources is usually one of the first things that you might be doing. However, configuring a VCN can be a bit involving when you think about all the sub-components that need attention such as subnets, route tables, gateways, security lists, etc. (See OCI Networking documentation for more details). The good news is that you can now launch a VCN with connectivity to the internet and Oracle Services Network in just a couple steps thanks to the new OCI Networking Quickstart wizard.
The wizard basically creates a VCN with regional public and private subnets, a NAT gateway, service gateway and an internet gateway along with the necessary route table and security list rules (including SSH access). It only prompts you to specify the IP CIDR block for the VCN and subnets. This reduces the number of steps and amount of time it takes to setup your network to 1-2 minutes. In this blog post, we are going to explore how to take advantage of this wizard to quickly launch a VCN as well as creating a compute instance in this VCN to connect to our Autonomous Database. Here's the outline of the steps that we are going to follow:
Create a VCN Using the Networking Quickstart Wizard
We have two options to launch the wizard:
In the wizard dialog, we will select 'VCN with Internet Connectivity' and click 'Start Workflow':
In the next page, we will enter the VCN name and specify the compartment, VCN and subnet CIDR blocks:
We will click 'Next' to review our configuration:
As the final step, we'll hit 'Create' and watch all the components being configured:
Provision a Compute Instance (Virtual Machine)
In the previous step, we have seen how easy it is to launch a VCN in just a couple minutes. As you may remember, our end goal is to access our ADW instance from within that VCN and we are almost there! Now, all we have to do is to provision a virtual machine (VM) in the VCN that we just created. Our VM can either be on a public subnet or a private subnet. A VM on a public subnet has the option to have a public IP address; on the other hand, a VM on a private subnet only has a private IP address that can be accessed within the same VCN. Just to demonstrate how we can access to our ADW instance from both public and private subnets, we will create two VMs as shown below.
Connect to our ADW Instance
So far we launched our VCN and created two VMs in it. At this point it's important to remember that one of our VMs (ctuzla-vcnpublic) is on a public subnet while the other VM (ctuzla-vcnprivate) is on a private subnet, meaning it doesn't have an assigned public IP address and cannot be accessed via the internet. Connecting to ADW from our VM on the public subnet is fairly easy. After copying our ADW wallet into our VM, we can just SSH into the VM using the public IP address and connect to the ADW instance in SQL Plus. In order to connect to ADW from our VM on the private subnet, we need to first connect to the VM itself and it requires couple additional steps. Since ctuzla-vcnprivate is on a private subnet, we will first connect to ctuzla-vcnpublic and ssh into ctuzla-vcnprivate using its private IP address (please note that we need to copy the private SSH key of ctuzla-vcnprivate into ctuzla-vcnpublic to be able to do this). Let's see all these steps in action (The steps below assume that we already have Oracle Instant Client set up and our ADW wallet available in both VMs):
ctuzla-mac$ ssh -i /Users/ctuzla/id_rsa firstname.lastname@example.org Last login: Wed Dec 11 18:43:03 2019 [opc@ctuzla-vcnpublic ~]$ [opc@ctuzla-vcnpublic instantclient_19_5]$ ./sqlplus ADMIN/************@adw_high SQL*Plus: Release 126.96.36.199.0 - Production on Wed Dec 11 19:51:33 2019 Version 188.8.131.52.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 184.108.40.206.0 - Production Version 220.127.116.11.0 SQL> select * from dual; D - X
ctuzla-mac$ ssh -i /Users/ctuzla/id_rsa email@example.com Last login: Wed Dec 11 19:38:41 2019 [opc@ctuzla-vcnpublic ~]$ [opc@ctuzla-vcnpublic ~]$ ssh -i /home/opc/id_rsa firstname.lastname@example.org Last login: Wed Dec 11 19:33:30 2019 [opc@ctuzla-vcnprivate ~]$ [opc@ctuzla-vcnprivate instantclient_19_5]$ ./sqlplus ADMIN/************@adw_high SQL*Plus: Release 18.104.22.168.0 - Production on Wed Dec 11 20:13:40 2019 Version 22.214.171.124.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 126.96.36.199.0 - Production Version 188.8.131.52.0 SQL> select * from dual; D - X
In this blog post, we have explored how to launch a VCN using the Networking Quickstart wizard, create a compute instance (on both public and private subnet), and connect to an ADW instance from within this VCN. As we have seen, the wizard turns the VCN creation into a much simpler and quicker process. If you would like to learn more about the new Networking Quickstart wizard, please check out the documentation here.