Cloud Quick Start

Revision as of 18:31, 13 May 2016 by Cgeroux (talk | contribs)
Other languages:

Getting a Cloud account

1. If you do not have a Compute Canada account, create one here.

2. If you do not have a WestGrid account, create one by connecting to CCDB.

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

3. Create your cloud account here.

Launching your first instance (VM)

Log into the East or West Cloud

 
OpenStack Dashboard, Compute Overview (Click for larger image)

Depending on where your project is located, go to the East cloud or the West cloud and enter your WestGrid credentials.

When you log in, the OpenStack dashboard shows an overview of your resources.

SSH Key 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 and you can only log in using this SSH key pair. The SSH public key can either come from a key pair which you have already created on some other machine, or can be created by OpenStack. If you are using an existing key pair from a remote machine, you will need to import the SSH public key into OpenStack so that it can be injected into the newly created VM. Alternatively OpenStack can create a key pair for you, with the private key downloaded to your local machine. In order to manage your key pairs, click on Access & Security from the left menu, then on the Key Pairs tab. From here you will have the option of Importing an existing key pair, or creating a new key pair.

Importing an Existing Key Pair

 
Import key pair (Click for larger image)
  1. Click  ; the Import Key Pair window is displayed.
  2. Name your key pair.
  3. Paste your public key.
  4. Click on the Import Key Pair button.

Creating a New Key Pair

 
Create key pair (Click for larger image)
  1. Click on  ; the Create Key Pair window is displayed.
  2. Name your key pair.
  3. Click on the Create Key Pair button.
  4. Save the <key name>.pem on your disk.
UNIX
On your local machine (not the VM), you will need to chmod 400 <key name>.pem in order to connect with this key.
WINDOWS
To use the key downloaded from OpenStack with PuTTY or MobaXterm to connect to the VM, you need to convert it to a format compatible with that software (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 item on the left, then click on  

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.

      Some constraints apply when choosing an instance name:

      1. must be under 253 characters
      2. each label (seperated by ".") must be between 1 and 63 characters long
      3. each label must contain only ASCII letters 'a' - 'Z' (case-insensitive), '0' - '9', and '-'
      4. labels must not start or end with a '-'
      5. must be case-insensitive (i.e. will convert upper case to lower case)
      ? 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 remove the checkmark 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 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 the instance 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 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 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 address 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 Allocate IP button. The Manage Floating IP Associations screen is displayed, indicating the IP address and the port to which it is NATted; simply click on the 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.

      1. On the Security Groups tab, select Access & Security; on the default row, click  
      2. On the next screen, click  
      3. SSH rules are predefined. Simply select SSH in the Rules dropdown menu and leave CIDR' under Remote?.
      4. 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.
      5. Finally, click the 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:

       
      [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:

       
      [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