0% found this document useful (0 votes)
83 views27 pages

01 - Lab - Creating A Single Instance

create instance

Uploaded by

kam_chan_syd7562
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views27 pages

01 - Lab - Creating A Single Instance

create instance

Uploaded by

kam_chan_syd7562
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Lab 1

ORACLE COMPUTE
CLOUD WORKSHOP

ORACLE PLATFORM
TECHNOLOGY SOLUTIONS

CREATING A SINGLE INSTANCE


Creating A Single Instance Page Lab 1 2

Creating a Single Instance


using Web UI
This LAB is about how to create an instance in Oracle Compute Cloud Service using
the Web Console User Interface. You'll create an instance by using an Oracle-
provided Oracle Linux image and boot the instance from a persistent disk. After
creating the instance, youll also set up a security rule to enable HTTP access to the
instance on port 80.

CREATING A SINGLE INSTANCE ........................................................................... 1


Creating a Single Instance using Web UI ............................................................. 2
Pre Requisites .................................................................. 2
Process Overview ............................................................... 3
Generating a SSH Key Pair .................................................. 4
If using Linux/Unix like Systems to access the Compute Cloud ..... 4
Generating an SSH Key Pair On Windows Using the PuTTY Key
Generator 5
Uploading the SSH Public Key to Oracle Compute Env. ............ 9
Creating a public IP address Reservation ............................. 10
Creating a Bootable Storage Volume ................................... 13
Creating an Instance ........................................................ 15
Creating a Security List ..................................................... 19
Logging in to your Instance using SSH ................................ 22
Logging In from a UNIX or UNIX-Like system ........................... 22
Logging In from a Windows System ........................................ 22
Verifying access to Port 80 ................................................ 26
APPENDIX - how to create SSH enabled Users ..................... 26

Pre Requisites

Access to user account details (provided to attendees via email)


created on Oracle Compute Cloud with Compute_Operations role
assigned
On Windows : PuTTY ( Refer LAB 0 )
On Unix (Linux, Mac) : ssh-keygen is already included in the
installation. ( Refer LAB 0 )

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 3

Process Overview

To create an Oracle Compute Cloud Service instance and set up HTTP access to the
instance, you must complete the following tasks:
1. Generate an SSH key pair on your local system.
2. Upload the SSH public key to Oracle Compute Cloud Service.
3. Reserve a public IP address for your instance.
4. Create storage volumes to boot the instance from, or to store your data and
applications.
5. Create your instance, associate a public IP address with it, configure it for
SSH access, and attach the storage volumes that you created, if any.
6. Configure the instance for HTTP access.
After creating the instance, you'll log in to it by using your SSH private key

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 4

Generating a SSH Key Pair


When you create your Oracle Compute Cloud Service instance, you must provide an
SSH public key that will be used for authentication when you log in to the instance.
Generate your SSH key pair and upload the SSH public key to the Oracle Compute
Cloud Service before you start to create your instance.

IF USING LINUX/UNIX LIKE SYSTEMS TO ACCESS THE COMPUTE


CLOUD

1. Run the ssh-keygen command.


ssh-keygen -b 2048 -t rsa
2. The command prompts you to enter the path to the file in which you want to
save the key. A default path and file name are suggested in parentheses. For
example: /home/user_name/.ssh/id_rsa.
To accept the default path and file name, press Enter.
Otherwise, enter the required path and file name, and then press Enter.
3. The command prompts you for a passphrase. Enter a passphrase.
Note that the passphrase isn't displayed when you type it in. Remember the
passphrase. If you forget the passphrase, you can't recover it.
4. When prompted, enter the passphrase again to confirm it.
The command generates an SSH key pair consisting of a public key and a private
key, and saves them in the specified path. The file name of the public key is created
automatically by appending .pub to the name of the private key file. For example, if
the file name of the SSH private key is id_rsa, then the file name of the public key
would be id_rsa.pub.
5. Make a note of the path where you've saved the SSH key pair. When you
create instances, you must provide the SSH public key. When you log in to an
instance, you must specify the corresponding private key and enter the passphrase
when prompted.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 5

GENERATING AN SSH KEY PAIR ON WINDOWS USING THE PUTTY


KEY GENERATOR

1. Find puttygen.exe in the PuTTY folder on your computer, and double-click it.
2. Accept the default key type, SSH-2 RSA, and set the Number of bits in a
generated key to 2048, if it is not already set. Then click Generate.

3. Move your mouse around the blank area to generate randomness. The
SSH key pair is generated.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 6

4. Save your private key.


a. The key comment is the name of the key. You can keep the generated key
comment or create your own.
b. Enter a passphrase in the Key passphrase and the Confirm
passphrase fields.
Note: Remember the passphrase. You can't recover a passphrase if you forget it.
c. To save the private key in the PuTTY PPK format, click Save private
key(e.g. rsa-key-1.ppk)
Enter the same name as you used for the key comment, so that you know which public
key to use this private key with. The private key is saved in PuTTY's Private Key (PPK)
format, which is a proprietary format that works only with the PuTTY toolset. You can
use this key whenever you use PuTTY for SSH.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 7

5.
6. Next, save your SSH public key.
a. In the PuTTY Key Generator, select all of the characters in the Public key
for pasting into OpenSSH authorized_keys file: field/textbox.
Note: Make sure you select all the characters, not just the ones you can see in the
narrow window. If there is a scroll bar next to the characters, you aren't seeing all the
characters.
b. Right click somewhere in the selected text and select Copy from the
menu.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 8

c. Open a text editor and paste the characters. Ensure that you paste the
text at the first character in the text editor, and don't insert any line
breaks.
d. Save the key using the same root name that you used for the private key.
Add a .pub extension. You can give it any extension you want, but .pub is
a useful convention to indicate that this is a public key.
e. Exit PuTTY Key Generator.
7. Make a note of the public and private key names and where they are saved.
When you create instances, you must specify the SSH public key. When you log
in to an instance, you must provide the path to the corresponding SSH private
key and enter the passphrase when prompted.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 9

Uploading the SSH Public Key to Oracle Compute Env.

1. Sign in to the Oracle Cloud My Services application


at https://cloud.oracle.com/sign_in. The My Services Dashboard page is
displayed.
2. Click the menu at the upper left corner of the page and select Oracle
Compute Cloud Service.
The Oracle Compute Cloud Service console is displayed.
3. From the Network tab on Overview page , click on SSH Public Keys.

4. Click Add SSH Public Key.


5. In the Add SSH Public Key dialog box, enter a name and the value of the SSH
public key you generated, and then click Add.
Note: Paste the key value exactly as it was generated. Don't append or insert any
extra characters, line breaks, or spaces.
Your SSH public key is added to Oracle Compute Cloud Service.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 10

Creating a public IP address Reservation

Create an IP address reservation. An IP reservation allows you to specify an IP


address that will be associated with your instance.

To create an IP reservation:

1. On the Oracle Compute Cloud Service web console, click the Network tab.
2. Click the IP Reservations tile, and then click Create IP Reservation.
3. In the Create Public IP Reservation dialog box, enter a name for the IP
address reservation, and then click Create.
Note: Do not select an instance from the For Instance list. You'll use this IP
address for the instance that you are about to create.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 11

Note: Make a note of this public IP address. You'll use it to access your instance
using SSH later.

Creating a Security Rule for SSH Access with the


Default Security List

When you create a security list, the instances in the security list are isolated from
hosts outside the security list. You can use security rules to override the default
access settings of security lists. Each security rule defines a source, a destination,
and a protocol-port combination over which communication is allowed.
In this tutorial, you'll set up a security rule to permit ssh requests from hosts on the
public Internet to port 22 of the instances in the default security list.
To create a security rule:
1. On the Oracle Compute Cloud Service web console, click the Network tab,
and then click the Security Rules tile.
2. Click Create Security Rule.
3. In the Create Security Rule dialog box, select or enter the following
information, and then click Create.
a. Name: Enter an appropriate name. For the purpose of this tutorial,
enter DefaultSSHAccess.
b. Status: Retain the default, Enabled.
c. Security Application: Select ssh.
Note: Many of the commonly-used protocol and port combinations are provided as
predefined security applications in Oracle Compute Cloud Service. However, if you
wish to specify a particular protocol-port mapping that is not predefined, you can
create the required security application in the Security Applications tile.
d. Source: From the Security IP Lists list, select public-internet.
e. Destination: From the Destination list, select the security list that is
already available i.e. default security list
f. Description: Enter a description DefaultSSHAccess

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 12

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 13

Creating a Bootable Storage Volume


When you create an Oracle Compute Cloud Service instance, by default, it is set up
to boot from a nonpersistent disk. To use a persistent boot disk, create a bootable
storage volume. If you use a bootable storage volume as the boot disk for an
instance, then any changes that you make to the boot disk aren't lost even when you
delete the instance.
To create a bootable storage volume:
1. Click on Storage tab, and then click Create Storage Volume.
The Create Storage Volume page will be opened.
2. In Create Storage Volume page, select or enter the following details and then
click Create.
a. Name: Enter an appropriate name. For the purpose of this tutorial,
enter bootable-vol-1.
b. Boot Image: Select the image that you want to use to create a
bootable storage volume. For example, select OL-6.6-2GB-x11-RD.
c. Size: Enter an appropriate size, in GB. For the purpose of this tutorial,
enter 22 (You may leave it to default).
Note: The size of the storage volume must be at least 5% larger than the selected
image size.
d. Storage Property: Select storage/default.
e. Description: Enter an appropriate description. For the purpose of this
tutorial, enter Bootable Storage Volume 22 GB.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 14

Your storage volume is created.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 15

Creating an Instance

1. If you are not already on the Instances page, click the Instances tab.
2. Click Create Instance button.
The Create Instance wizard starts.
3. Image: On the Image page, select the image that you want to use. For the
purpose of this tutorial, select an ol_6.6*** image and then click > button

NOTE: Please do not use the JEOS*** imagelist to create


your instances

4. Shape: On the Shape page, select an appropriate shape for your instance.
The shape determines the number of CPUs and RAM that your instance will
have.
For the purpose of this tutorial, select oc3 (OCPUs: 1, Memory: 7.5 GB)
and click on next (>) button.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 16

5. In the instance page, select or enter the following information and click on Next
(>) button:
a. High Availability Policy: Leave it to default as Active
b. Name: You may change the auto generated name to some meaningful name. For
this lab, give name as VM-1
c. Label: Enter a label to help identify the instance. If you provide a label, the label
is used to list the instance on the Overview page. For this lab, provide label as
My-First-Instance
d. Description: (Optional) Provide some meaningful description
e. Tags: If required, specify a tag to help identify your instance. For this lab, leave
this as blank.
f. DNS Hostname Prefix: Enter a string that will be used as a prefix in the domain
host name for your instance. For the purpose of this lab, you can leave this blank.
g. Public IP Address: Select Persistent Public IP Reservation, and from the list,
select the IP reservation that you created earlier.
h. Security Lists: You may select the existing security list (will be shown once you
click in the text field). For the purpose of this tutorial, please select the default
security list.
i. SSH Keys: Select the SSH Public Keys that you created earlier from the list which
will be shown once you click in the text field
j. Custom Attributes: You may add the required custom attributes, if you want to
pass. For the purpose of this tutorial, you can leave this blank.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 17

6. On the Storage page, select the following, and then click Next (>) button:
a. If you have created storage volumes to store applications and data, then
click on Attach Existing Volume and select those volumes.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 18

Note: You can select only storage volumes that are not already attached to an
instance. Storage volumes that have been attached are displayed but grayed out.
b. Select the bootable storage volume bootable-vol-1 from the list.
c. Also check Boot Drive option
d. Then, click on Add button

7. On the Review page, verify the information that you've entered and then click Create.

Your instance is created. Your instance is now configured to allow public access only
over SSH, and only those having the private key(e.g. rsa-key-1.ppk) will be able to
access.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 19

Creating a Security List


A security list is a set of instances that can communicate with each other across all
protocols and ports. When you create a security rule, you specify a security list as a
destination. This allows traffic from a specified source (such as the public Internet) to
access all the instances that are part of the destination security list over a specified
protocol and port.
To create a security list to allow access to Port 80 (i.e http)
1. On the Oracle Compute Cloud Service web console, click the Network tab.
2. Click the Security Lists tile, and then click Create Security List.
3. In the Create Security List dialog box, select or enter the following
information, and then click Create.
a. Name: Enter an appropriate name. For the purpose of this tutorial,
enter For-http-access.
b. Inbound Policy: Retain the default policy, Deny (Drop packets, no
reply).
c. Outbound Policy: Retain the default policy, Permit (Allow
packets).
d. Description: Enter a description.

Adding Your Instance to the Security List


1. On the Oracle Compute Cloud Service web console, click the Overview tab.
2. If you are not already on the Instances page, click the Instances tile.
3. Go to the instance that you just created, and from the menu, select View.
4. On the instance details page, click Add to Security List.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 20

Select the security list that you just created, and then click Attach.This is the
second security list attached to the instance in addition to the default
security list.
Your instance is added to the For-http-access security list.

Creating a Security Rule


When you create a security list, the instances in the security list are isolated from
hosts outside the security list. You can use security rules to override the default
access settings of security lists. Each security rule defines a source, a destination,
and a protocol-port combination over which communication is allowed.
In this tutorial, you'll set up a security rule to permit HTTP requests from hosts on
the public Internet to port 80 of the instances in the For-http-access security list.
To create a security rule:
4. On the Oracle Compute Cloud Service web console, click the Network tab,
and then click the Security Rules tile.
5. Click Create Security Rule.
6. In the Create Security Rule dialog box, select or enter the following
information, and then click Create.
a. Name: Enter an appropriate name. For the purpose of this tutorial,
enter Allow-http-access.
b. Status: Retain the default, Enabled.
c. Security Application: Select http.
Note: Many of the commonly-used protocol and port combinations are provided as
predefined security applications in Oracle Compute Cloud Service. However, if you
wish to specify a particular protocol-port mapping that is not predefined, you can
create the required security application in the Security Applications tile.
d. Source: From the Security IP Lists list, select public-internet.
e. Destination: From the Destination list, select the security list that
you created earlier, For-http-access.
f. Description: Enter a description.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 21

Repeat these steps if you want to create security rules to enable access to instances
using other protocols and ports, or if you want to specify a different source or
destination.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 22

Logging in to your Instance using SSH

LOGGING IN FROM A UNIX OR UNIX-LIKE SYSTEM

1. Enter the following command:


$ ssh -i /path/to/private_key opc@public_ip_address_of_the_instance
Note: If you don't know the public IP address of your instance, you can find it by
going to the Instances tile on the Oracle Compute Cloud Service console and clicking
your instance to get to the details page.
2. When prompted, enter the passphrase you had provided for your SSH key
pair.

LOGGING IN FROM A WINDOWS SYSTEM

1. Start PuTTY.
The PuTTY Configuration window is displayed, showing the Session panel.
2. In the Host Name (or IP address) field, enter the public IP address of your
instance.
Note: If you don't know the public IP address of your instance, you can find it by
going to the Instances tile on the Oracle Compute Cloud Service console and clicking
your instance to get to the details page.
3. In the Connection type: field, select SSH if it is not already selected.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 23

4. In the Category pane, expand Connection, and then click Data.


The Data panel is displayed.
5. In the Auto-login username field, enter opc.
Confirm that the When username is not specified option is set to Prompt.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 24

6. In the Category pane, expand SSH, and then click Auth.


The Auth panel is displayed.
7. In the Private key file for authentication field, click Browse and select
the private key file that you saved earlier.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 25

8. In the Category tree, click Session.


The Session panel is displayed.
9. In the Saved Sessions field, enter a name for this connection configuration,
and then click Save.
10. Click Open to open the connection.
The PuTTY Configuration window is closed and the PuTTY window is displayed.
11. Enter the passphrase you had provided for your SSH key pair.
12. The first time you connect to your instance, the PuTTY Security Alert window
is displayed, prompting you to confirm the public key. Click Yes to continue.

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 26

Verifying access to Port 80

Start Python Web Server and access the same from the Browser

1). $ sudo python -m SimpleHTTPServer 80


This command starts an http server on your instance at port 80

2). Use the Public Ip of your VM instance and paste it in a new browser window.
(Click on your VM instance in the UI Web Console and note down the Public IP
address of the VM instance)
An example screenshot below :
NOTE: Your VM instance IP address will be different than the one shown in
the figure below

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop
Creating A Single Instance Page Lab 1 27

APPENDIX

How to create SSH enabled users on Oracle compute


cloud services instances

Go through the following tutorial to create SSH enabled users

Copyright 2015, Oracle Corporation


Module Lab 1
Oracle Compute Cloud Workshop

You might also like