Sunday, August 11, 2019

Oracle Cloud (OCI):: Compute Instance

Oracle Cloud Infrastructure Compute lets you provision and manage compute hosts, known as instances . You can launch instances as needed to meet your compute and application requirements. After you launch an instance, you can access it securely from your computer, restart it, attach and detach volumes, and terminate it when you're done with it. Any changes made to the instance's local drives are lost when you terminate it. Any saved changes to volumes attached to the instance are retained.

In this tutorial, I will take you through the steps to create a Linux VM Compute Instance in Oracle Cloud Console and attached Block Storage to it.


1. The public key, in OpenSSH format, from the key pair that you plan to use for connecting to the instance via SSH. The following command works with Linux and Git Bash (Windows), and you only have to press enter for all steps. The generated SSH keys can be found inside the "~/.ssh/" folder in Linux or in the "C:/Users/<username>/.ssh" folder in Windows.

$ ssh-keygen

2. A virtual cloud network to launch the compute instance into.

Create Compute Instance:

1. Login to Oracle Cloud Console. Browse and click Sign In at the top of the page. Enter the Account Name and click on Next. Select Identity Provider as 'oracleidentitycloudservice' and click on Continue button under Single Sign-On Section. Enter Username and Password, click on Sign In. You're then directed to the Oracle Cloud Console.

Refer to post to get trail access to Oracle Cloud.

2. Open the navigation menu. Under Core Infrastructure, go to Compute and click Instances.

3. Choose a Compartment you have permission to work in, and then click Create Instance.

4. In the Create Compute Instance dialog box, specify the following:
Name your instance: 
Select an availability domain for your instance:   AD1, AD2 or AD3
Choose an operating system or image source:  Oracle Linux 7.6
Choose instance type: Virtual Machine
Choose instance shape:  VM.Standard2.1
Add SSH key: Add the generated key

Configure networking:
Virtual cloud network compartment: The compartment you created

You can leave rest of the fields empty if Virtual Cloud Network(VCN) is not created. System will automatically creates a new VCN in the same compartment with access to the internet.

If VCN already created in the compartment, then choose accordingly.

Click on Create.

5. The new instance has been created and has a public IP address.

6. Open the navigation menu. Under Core Infrastructure, go to Networking and click 'Virtual Cloud Networks'. Existing VCN list will be displayed. Select the VCN and Click on 'Security List'.

7. Check the ingress rule, whether SSH connectivity enabled or not.

Connect to Compute Node via Putty:

8. Open puttygen to save private RSA key as .ppk file.
9. Open putty and provide instance public IP address and choose private ppk file. Click Open. Log in user: opc

Create Block Volume:

10. Open the navigation menu. Under Core Infrastructure, go to Block Storage and click 'Block Volumes'. Select compartment and Click on 'Create Block Volume'.

11. In the Create Block Volume dialog box, specify the following and Click on Create Volume button.
Block Volume Name: 
Compartment Name: 
Select an availability domain: 
Volume Size: 

12. Block Volume details will be displayed as shown below. Wait until it's available.

Attach Block Volume:

13. Open the navigation menu. Under Core Infrastructure, go to Compute and click Instances. Select the existing Compute Instance. Navigate to 'Attached Block Volumes'. Click on 'Attach Block Volume'.

14. In the Attach Block Volume dialog box, specify the following and Click on Attach button.
Choose the mechanism to attached volume:
Access Type: 
Block Volume:
Device Path: 

15. When the attachment is complete, need to run iSCSI commands to enable the block volume.

16. Click on 'iSCSI Commands & Information'. Switch to putty session and run the commands as mentioned.


17. Terminate: Open the navigation menu. Under Core Infrastructure, go to Compute and click Instances. Select the existing Compute Instance and click on Terminate. Similarly for Block Volume.

No comments:

Post a Comment

Provide your thoughts !