Create Compute Instance on Oracle Cloud Infrastructure (OCI) Free Tier
By: Harjul Jobanputra
Tags: Oracle, Free Tier, Oracle Cloud

Create Compute Instance on Oracle Cloud Infrastructure (OCI) Free Tier

Let us create a demo instance in free tier on Oracle Cloud Infrastructure

Scenario:

We will log in to Oracle Cloud infrastructure with assigned tenant and credentials. After login, we will provision a Compute Instance with default boot volume and private IP address. To connect to this instance, having only private IP address, we need Public IP address. For that we will assign a Public IP address either Ephemeral or reserved IP address by updating assigned vNIC to the instance. Once Public IP assigned to the instance, we will test the connection to compute instance via putty, providing private key (part of public-private key pair). After successful connection, we will attach additional volume to the instance, furthermore we will modify the IOPS parameter to the recently attached block volume and verify instance status during volume IOPS modification. Post to this, we can deploy apache web server and configure our first website and provide them to the end user.

1. Login to oracle cloud infrastructure with assigned tenant and credentials.

2. Look at the Oracle Cloud Infrastructure Dashboard.

3. Click on the “Create VM Instance” tab under Quick Actions.

4. You will land up on “Create Compute Instance” screen as shown here.

Click on “Show Shape, Network and Storage Options” to drill down further to see available Shape, Network and Storage options.

Add Public key generated using Putty Key Gen on Windows and retain private key for future connection to this compute instance.

5. Click “Create” to complete the instance creation.

Wait till instance state change from “Provisioning” to “Running” once to connect to the instance.

While checking instance information, it is found that the instance does not have Public IP address, without which you will not be able to connect to the instance.

To assign public IP address to existing instance, go to “Attached vNIC” section under Resources section

Click on the VNIC created just now — “instance-20191121–1416”

Scroll down and click on “IP Address” under Resources on left side of the screen.

Click “Edit” menu on the right side in IP Address section.

This will take you to modify the IP Address assignment

Modify existing “NO PUBLIC IP” to either “EPHEMERAL PUBLIC IP” or “RESERVED PUBLIC IP”.

The change should be reflected as

Now, you should be able to see PUBLIC IP Address for the instance under “Instances” section.

Feed public IP address in putty along with private key to login to the server.

Click “Open”

Login as “opc” user.

Elevate your role to root user and check the current disk space used in file system on the server.

Now we will create another mount point on the server by creating block volume and attach the same to the instance.

Let us create a block volume. Go to menu on the left side, click on Block Storage -> Block Volume

You can create Block volume from this screen. If any existing block volumes created previously then they are listed over here.

Click “Create Block Volume” to create a block volume.

In OCI, you have option to define volume based on performance need. By default “Balanced” is selected for the expected volume performance however you may scroll the bar left or right to modify volume performance to Lower Cost or Higher Performance based on application demand.

For this demo, we will keep it as “Balanced” and then we will reduce it to “Lower Cost” after volume is attached to the recently created instance.

You also have option to encrypt either using Oracle Managed Key or Customer Managed key. Select appropriate option and click on “Create Volume”.

You may go back to earlier created instance.

On left side, under Resources section, click on “Attached Block Volume” to attach newly created block volume to this instance.

Fill up details like how you want to attach the volume to the instance, Access Type, Name of the block volume, and device path.

Click “Attach” and will attach the block volume to the instance. It will also display following screen.

Go to menu on the right side of the attached volume and click on “iSCSI commands & information” , copy commands listed under “Attach Commands” section and execute on the instance as root user.

Login to the compute instance and follow below steps to create file system, mount point and attach volume to it.

# lsblk

#sudo mkdir /u01

# sudo mount /dev/sdb /u01

Now, you want to change the volume performance from “Balanced” to “Lower Cost”

While doing so, we will ensure the volume remains available to the instance and user is not affected during the operation.

Go to Block storage and click on block volume recently created in above steps.

Click on “Change Performance” button.

Convert this to “Lower Cost” and click on “Change Performance” button.

While block volume status changes from “Provisioning” to “Available”, following operations were being performed on the volume on compute instance.

Operations were performed successfully without any issues.

Block volume comes back to “Available” Status.

Hope you find this document useful.

Disclaimer: Above commands are executed based on my understanding and knowledge on Oracle Cloud. Do not treat this as best practice document provided by my organization. This one is demonstrated to showcase the simplicity of creating compute instance along with block volume on oracle cloud.