Cloud Quick Start: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:
=Launching your first instance (VM)= <!--T:26-->
=Launching your first instance (VM)= <!--T:26-->
==Login to the East or West Cloud==
==Login to the East or West Cloud==
[[ I think we should choose INSTANCE or VM and stick with the term instead of using both without distinction]]
[[File:OpenStack-Dashboard-Compute-Overview.png|400px|thumb| OpenStack Dashboard, Compute Overview (Click for larger image)]]
[[File:OpenStack-Dashboard-Compute-Overview.png|400px|thumb| OpenStack Dashboard, Compute Overview (Click for larger image)]]
Go to [https://east.cloud.computecanada.ca https://east.cloud.computecanada.ca] or [https://west.cloud.computecanada.ca https://west.cloud.computecanada.ca] and enter your WestGrid credentials. After you have logged in, you are presented with the dashboard. From here you can see an overview of the resources you are using.  
Depending on where your project is located [??], go to [https://east.cloud.computecanada.ca https://east.cloud.computecanada.ca] or [https://west.cloud.computecanada.ca https://west.cloud.computecanada.ca] and enter your WestGrid credentials.
When you log in, the dashboard is displayed and you have an overview of your resources.  


==SSH Key Pair== <!--T:2-->
==SSH Key Pair== <!--T:2-->
When you start a virtual machine (or "instance") there is no password for admin or root account on the VM, and no one can log in to it using a password. We do this for security reasons: You would not want a hacker to be able to access the brand new VM you just started using some default password. Therefore OpenStack will create your VM with one SSH public key installed, and you can only log in to it with that SSH key pair. You can either import an existing SSH key pair through OpenStack, or you can create a new pair.
 
In order to manage your key pair, click on “Access & Security” from the left menu, then on the “Key Pairs” tab.
[[ should we use KEY or KEY PAIR (sometimes just PAIR) ?]]
When you start an instance, there is no password for an admin or a root account on the virtual machine. This is for security reasons, so that no one can log in with a password (you wouldn't want a hacker to be able to access the brand new VM you just started using some default password...)
 
[?this is not clear; does OS create the keyPair or does it need to be imported or do I need to create the keyPair?]
OpenStack creates your VM with one SSH public key installed; you can only log in with this SSH key pair.
You can either import an existing SSH key pair through OpenStack or you can create a new pair.
In order to manage your key pair, click on ''Access & Security'' from the left menu, then on the ''Key Pairs'' tab.


===Importing an Existing Key Pair=== <!--T:3-->
===Importing an Existing Key Pair=== <!--T:3-->
Line 26: Line 36:
##Give a name to your key.
##Give a name to your key.
##Paste your public key.
##Paste your public key.
##Click on the blue Import Key Pair button.
##Click on the blue ''Import Key Pair'' button.


===Creating a New Key Pair=== <!--T:4-->
===Creating a New Key Pair=== <!--T:4-->
[[File:Create-Key-Pair-Form.png|400px|thumb| Create key pair (Click for larger image)]]
[[File:Create-Key-Pair-Form.png|400px|thumb| Create key pair (Click for larger image)]]
#Click [[File:Create-Key-Pair-Button.png]]
#Click on [[File:Create-Key-Pair-Button.png]]
#Then,
#Then,
##Give your key a name.
##Give your key a name.
##Click on the blue Create Key Pair button.
##Click on the blue ''Create Key Pair'' button.
##Save the <key name>.pem on your disk.
##Save the <key name>.pem on your disk.


<!--T:5-->
<!--T:5-->
On UNIX hosts, you will need to <code>chmod 400 <key name>.pem</code> in order to connect later on. This needs to be done on your machine, not the VM. In windows to use the key downloaded from OpenStack with PuTTY or MobaXterm you need to convert it to a format they understand steps to do this are given on the [[Generating ssh keys in Windows#Converting an OpenStack Key]] page.
On UNIX hosts, you will need to <code>chmod 400 <key name>.pem</code> in order to connect later on. This needs to be done on your machine, not the VM.  
 
On Windows hosts, to use the key downloaded from OpenStack with PuTTY or MobaXterm, you need to convert it to a Windows compatible format (see [[Generating ssh keys in Windows#Converting an OpenStack Key]].


==Launching a VM== <!--T:6-->
==Launching a VM== <!--T:6-->
[[File:Launch-Instance-Form.png|400px|thumb| Launch Instance (Click for larger image)]]
[[File:Launch-Instance-Form.png|400px|thumb| Launch Instance (Click for larger image)]]
To launch an instance, click on the Instances menu on the left, then click [[File:Launch-Instance-Button.png]]
To launch an instance, click on the ''Instances'' menu on the left, then click on [[File:Launch-Instance-Button.png]]


<!--T:7-->
<!--T:7-->
You are now presented with a form to define your instance. For this walk-through, fill in the arbitrary values described below.
A form is displayed where you define the instance (if you are following along with this example, you can use the same values).
*Details tab
*''Details'' tab
**Availability Zone: There is only one zone.  Leave it unchanged.
**''Availability Zone'': There is only one zone; do not change its name.
**Instance name: <code>test</code><br/>Make up a name for your instance.
**''Instance name'': <code>test</code><br/>Enter a name for your instance. [[? are there naming constraints ? length, character types, etc.) ?]]
**Flavor: <code>c1-3.75gb-36</code><br/>The flavor name defines the specifications of the VM. This particular flavor has one virtual CPU, 3.75 GB of RAM (memory) and an ephemeral disk of 36GB. Ephemeral disks are disks created and destroyed with the instance and reside on the local hardware running the VM. Flavors starting with a "p" do not have an extra ephemeral disk and thus no "-##" on the end. They also have a very small root disk of only 2.2G, with a typical OS taking about 770MB of that. The root disk, as you might have guessed, is mounted at the root of the linux file system. Flavors starting with a "c" have an extra ephemeral disk attached, as well as a 20GB root disk.
**''Flavor'': <code>c1-3.75gb-36</code><br/>The flavor defines [instance/VM] specifications. This particular flavor has one virtual CPU, 3.75GB of RAM (memory) and an ephemeral disk of 36GB. Ephemeral disks are disks created and destroyed with the instance; they reside on the local hardware running the VM.
**Instance Count: <code>1</code><br/>The number of VMs to create.
 
**Instance Boot Source: Boot from image<br/> Indicates that you wish to boot from an already created image.
Flavors starting with a "p" do not have an extra ephemeral disk and thus no "-##" on the end. They also have a very small root disk of only 2.2G, with a typical OS taking about 770MB of that. The root disk, as you might have guessed, is mounted at the root of the Linux file system.
**Image Name: <code>CentOS-7-x86-64-GenericCloud-1503</code><br/>Name of the image to boot from.
 
**Project Limits: The green bars reflect the fraction of your available resources that will be consumed by the VM you are about to launch. If the bars become red it indicates the flavor chosen will consume more resources than your project has available. Blue bars indicate any existing resources your project may be using.
Flavors starting with a "c" have an extra ephemeral disk attached, as well as a 20GB root disk.
*Access & Security tab<br/>
**''Instance Count'': <code>1</code><br/>Number of VMs to create.
**Key Pair: Select your SSH key pair. If you have only one, it will be selected by default. If you do not have a key pair please see above steps [Cloud Quick Start#SSH Key Pair].
**''Instance Boot Source'': Boot from image<br/> Indicates that you wish to boot from an already created image. [[??]]
**Security Groups: Leave <code>default</code> selected here.
**''Image Name'': <code>CentOS-7-x86-64-GenericCloud-1503</code><br/>Name of the image to boot from.
*Networking tab<br/>You do not need to change this now. Networking will be discussed below after you have launched in instance.
**''Project Limits'': The green bars reflect the fraction of your available resources that will be consumed by the VM you are about to launch.
*Post-Creation Tab<br/>No need to change this now. This is where you can paste a '''cloud-init''' script which can do things like install and configure software and add users and additional SSH keys (see [[OpenStack#Accessing a VM with Multiple Users]]) in an automated step after the VM is created. See [http://cloudinit.readthedocs.org/en/latest/index.html# cloudinit] for more details about clout-init.
 
*Advanced Options tab<br/>Leave Disk Partition on "Automatic" for now.
If the bars become red, the flavor chosen will consume more resources than your project has available.
 
Blue bars indicate any existing resources your project may be using.
*''Access & Security'' tab<br/>
**''Key Pair'': Select your SSH key pair.
If you have only one, it is selected by default.
If you do not have a key pair, please see above [Cloud Quick Start#SSH Key Pair].
**''Security Groups'': Do not change <code>default</code>.
*''Networking tab''<br/>Do not change this now. Networking will be discussed later, after you have launched an instance.
*''Post-Creation Tab''<br/>Do not change this now. This is where you would paste a '''cloud-init''' script which can do things [[?working?]]like install and configure software and add users and additional SSH keys (see [[OpenStack#Accessing a VM with Multiple Users]]) in an automated step after the VM is created. See [http://cloudinit.readthedocs.org/en/latest/index.html# cloudinit] for more details about clout-init.
*''Advanced Options'' tab<br/>Leave ''Disk Partition'' on ''Automatic'' for now.


<!--T:8-->
<!--T:8-->
Once you have reviewed all the tabs and defined your instance, click on the blue Launch button and your instance will be created. The Instances list will appear, and the Status field will change, reflecting the different tasks that have to happen until it is running. It may take a few minutes for your instance to start, depending on a variety of factors.
Once you have reviewed all the tabs and defined your instance, click on the blue ''Launch'' button and your instance will be created.
The ''Instances'' list will be displayed and the ''Status'' field will show the different tasks required before it is run. It may take a few minutes for your instance to start, depending on a variety of factors.


<!--T:9-->
<!--T:9-->
Note: When creating a persistent service, we recommend that you boot your instance from a volume. See [[Persistent Services In The Cloud]].
Note: When creating a persistent service, we recommend that you boot your instance from a volume. See [[Persistent Services In The Cloud]].


==Network== <!--T:10-->
==Network== <!--T:10-->


===Private IP=== <!--T:11-->
===Private IP=== <!--T:11-->
On the Instance list, you will see the IP addresses to which your instance is linked. By default a network on <code>192.168.X.0</code> is created for your tenant (also referred to as a "project" on the OpenStack dashboard). You can see the private IP your instance has on the Instance list screen. You can use this IP to communicate with other instances you have started on the same cloud.
On the ''Instances''[[sing or plur?] list, are the IP addresses to which your instance is linked. By default a network on <code>192.168.X.0</code> is created for your tenant (also referred to as a "project" on the OpenStack dashboard).
The ''Instances''[[sing or plur?] list shows your instance's private IP. You can use this IP to communicate with other instances running on the same cloud.


===Public IP (Assign a public IP)=== <!--T:12-->
===Public IP (Assign a public IP)=== <!--T:12-->
To assign a public IP, you need to select “Associate Floating IP” from the More button of the Actions column of the Instances list. If this is your first time through this Quick Start Guide, your tenant hasn't been assigned any external IP addresses yet. You need to click on the “+” sign to bring up the "Allocate Floating IP" dialogue box. There is only one pool of public addresses, so the correct Pool will already be selected. You simply click on the blue Allocate IP button. You will be returned to the "Manage Floating IP Associations" screen, the IP Address field should be populated, and the port to which it should be [https://en.wikipedia.org/wiki/Network_address_translation NATted] should
To assign a public IP, you need to select ''Associate Floating IP'' from the ''More'' button of the ''Actions'' column in the ''Instances'' list. If this is your first time through this Quick Start Guide, your tenant hasn't been assigned an external IP addresses yet. You need to click on the “+” sign to bring up the ''Allocate Floating IP'' dialog box. There is only one pool of public addresses, so the correct pool will already be selected; simply click on the blue ''Allocate IP''button.
already be selected. Simply click on the blue Associate button.
The ''Manage Floating IP Associations'' screen is displayed, indicating the IP address and the port to which it is [https://en.wikipedia.org/wiki/Network_address_translation NATted]; simply click on the blue ''Associate'' button.


<!--T:13-->
<!--T:13-->
Line 79: Line 103:


===Firewall, Add Rules to Allow SSH=== <!--T:14-->
===Firewall, Add Rules to Allow SSH=== <!--T:14-->
In order to be able to connect to your instance via SSH, you will need to allow SSH to get through.
To connect to your instance via SSH, you will need to allow SSH to get through.


<!--T:15-->
<!--T:15-->
Go to “Access & Security”, in the “Security Groups” tab, then on the default row click [[File:Manage-Rules-Button.png]]
On the ''Security Groups'' tab, select ''Access & Security''; on the default row, click [[File:Manage-Rules-Button.png]].


<!--T:16-->
<!--T:16-->
On the next screen, click [[File:Add-Rule-Button.png]]
On the next screen, click [[File:Add-Rule-Button.png]].


<!--T:17-->
<!--T:17-->
For SSH, there are already predefined rules. Simply select SSH in the Rules drop down menu, then under Remote, keep CIDR.
SSH rules are predefined. Simply select SSH in the'' Rules'' dropdown menu and leave ''CIDR' under ''Remote''[[?]].


<!--T:18-->
<!--T:18-->
If you know which address you are connecting from, type it in the CIDR text field; otherwise keep 0.0.0.0/0. This will allow the whole world to connect to your server via SSH.  
If you know which address you are connecting from, type it in the CIDR text field; otherwise leave 0.0.0.0/0. This will allow universal access to your server via SSH.  


<!--T:19-->
<!--T:19-->
Finally, click the blue Add button.
Finally, click the blue ''Add'' button.


<!--T:20-->
<!--T:20-->

Revision as of 22:42, 9 May 2016

Other languages:

Getting a Cloud account

1. If you do not have a Compute Canada account, create one at https://www.computecanada.ca/research-portal/account-management/apply-for-an-account/.

2. If you do not have a WestGrid account, create one at https://ccdb.computecanada.ca/.

Under My Account, select Apply for a Consortium Account [?other steps?] and click the Apply button next to WestGrid.
You need confirmation from WestGrid to continue.

3. Apply for your cloud account at https://www.computecanada.ca/create-a-cloud-account/.

Launching your first instance (VM)

Login to the East or West Cloud

I think we should choose INSTANCE or VM and stick with the term instead of using both without distinction

OpenStack Dashboard, Compute Overview (Click for larger image)

Depending on where your project is located [??], go to https://east.cloud.computecanada.ca or https://west.cloud.computecanada.ca and enter your WestGrid credentials. When you log in, the dashboard is displayed and you have an overview of your resources.

SSH Key Pair

should we use KEY or KEY PAIR (sometimes just PAIR) ? When you start an instance, there is no password for an admin or a root account on the virtual machine. This is for security reasons, so that no one can log in with a password (you wouldn't want a hacker to be able to access the brand new VM you just started using some default password...)

[?this is not clear; does OS create the keyPair or does it need to be imported or do I need to create the keyPair?] OpenStack creates your VM with one SSH public key installed; you can only log in with this SSH key pair. You can either import an existing SSH key pair through OpenStack or you can create a new pair. In order to manage your key pair, click on Access & Security from the left menu, then on the Key Pairs tab.

Importing an Existing Key Pair

Import key pair (Click for larger image)
  1. Click Import-Key-Pair-Button.png
  2. Then,
    1. Give a name to your key.
    2. Paste your public key.
    3. Click on the blue Import Key Pair button.

Creating a New Key Pair

Create key pair (Click for larger image)
  1. Click on Create-Key-Pair-Button.png
  2. Then,
    1. Give your key a name.
    2. Click on the blue Create Key Pair button.
    3. Save the <key name>.pem on your disk.

On UNIX hosts, you will need to chmod 400 <key name>.pem in order to connect later on. This needs to be done on your machine, not the VM.

On Windows hosts, to use the key downloaded from OpenStack with PuTTY or MobaXterm, you need to convert it to a Windows compatible format (see Generating ssh keys in Windows#Converting an OpenStack Key.

Launching a VM

Launch Instance (Click for larger image)

To launch an instance, click on the Instances menu on the left, then click on Launch-Instance-Button.png

A form is displayed where you define the instance (if you are following along with this example, you can use the same values).

  • Details tab
    • Availability Zone: There is only one zone; do not change its name.
    • Instance name: test
      Enter a name for your instance. ? are there naming constraints ? length, character types, etc.) ?
    • Flavor: c1-3.75gb-36
      The flavor defines [instance/VM] specifications. This particular flavor has one virtual CPU, 3.75GB of RAM (memory) and an ephemeral disk of 36GB. Ephemeral disks are disks created and destroyed with the instance; they reside on the local hardware running the VM.

Flavors starting with a "p" do not have an extra ephemeral disk and thus no "-##" on the end. They also have a very small root disk of only 2.2G, with a typical OS taking about 770MB of that. The root disk, as you might have guessed, is mounted at the root of the Linux file system.

Flavors starting with a "c" have an extra ephemeral disk attached, as well as a 20GB root disk.

    • Instance Count: 1
      Number of VMs to create.
    • Instance Boot Source: Boot from image
      Indicates that you wish to boot from an already created image. ??
    • Image Name: CentOS-7-x86-64-GenericCloud-1503
      Name of the image to boot from.
    • Project Limits: The green bars reflect the fraction of your available resources that will be consumed by the VM you are about to launch.

If the bars become red, the flavor chosen will consume more resources than your project has available.

Blue bars indicate any existing resources your project may be using.

  • Access & Security tab
    • Key Pair: Select your SSH key pair.

If you have only one, it is selected by default. If you do not have a key pair, please see above [Cloud Quick Start#SSH Key Pair].

    • Security Groups: Do not change default.
  • Networking tab
    Do not change this now. Networking will be discussed later, after you have launched an instance.
  • Post-Creation Tab
    Do not change this now. This is where you would paste a cloud-init script which can do things ?working?like install and configure software and add users and additional SSH keys (see OpenStack#Accessing a VM with Multiple Users) in an automated step after the VM is created. See cloudinit for more details about clout-init.
  • Advanced Options tab
    Leave Disk Partition on Automatic for now.

Once you have reviewed all the tabs and defined your instance, click on the blue Launch button and your instance will be created. The Instances list will be displayed and the Status field will show the different tasks required before it is run. It may take a few minutes for your instance to start, depending on a variety of factors.

Note: When creating a persistent service, we recommend that you boot your instance from a volume. See Persistent Services In The Cloud.

Network

Private IP

On the Instances[[sing or plur?] list, are the IP addresses to which your instance is linked. By default a network on 192.168.X.0 is created for your tenant (also referred to as a "project" on the OpenStack dashboard). The Instances[[sing or plur?] list shows your instance's private IP. You can use this IP to communicate with other instances running on the same cloud.

Public IP (Assign a public IP)

To assign a public IP, you need to select Associate Floating IP from the More button of the Actions column in the Instances list. If this is your first time through this Quick Start Guide, your tenant hasn't been assigned an external IP addresses yet. You need to click on the “+” sign to bring up the Allocate Floating IP dialog box. There is only one pool of public addresses, so the correct pool will already be selected; simply click on the blue Allocate IPbutton. The Manage Floating IP Associations screen is displayed, indicating the IP address and the port to which it is NATted; simply click on the blue Associate button.

Manage Floating IP (Click for larger image)

Firewall, Add Rules to Allow SSH

To connect to your instance via SSH, you will need to allow SSH to get through.

On the Security Groups tab, select Access & Security; on the default row, click Manage-Rules-Button.png.

On the next screen, click Add-Rule-Button.png.

SSH rules are predefined. Simply select SSH in the Rules dropdown menu and leave CIDR' under Remote?.

If you know which address you are connecting from, type it in the CIDR text field; otherwise leave 0.0.0.0/0. This will allow universal access to your server via SSH.

Finally, click the blue Add button.

Add Rule (Click for larger image)

Connecting To Your Instance With SSH.

If you created a key pair on the first step, you will need to know where it is.

If connecting from a Linux machine:

Question.png
[name@server ~]$  ssh -i /path/where/your/key/is/my_key.key username@<public IP of your server>

Most common Linux distributions have standardized on the name of the distro as the username. To connect to the provided CentOS images, you would use:

Question.png
[name@server ~]$ ssh -i /path/where/your/key/is/my_key.key centos@<public IP of your server>

where <public IP of your server> is the public IP you set in the previous step (Cloud Quick Start#Public IP (Assign a public IP)). The username for Ubuntu instances is “ubuntu” and Debian instances have the “debian” username. By default the preconfigured cloud username will have full sudo privileges. The root account is normally disabled.

You are now connected to your instance.

If connecting from a windows machine

see Connecting with PuTTY or Connecting with MobaXTerm

Where To Go From Here