Beruflich Dokumente
Kultur Dokumente
com
Chris Anderson
12/17/12
Page 1
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Table
of
Contents
1.1 1.2 1.3
1.3.1 1.3.2 1.3.3 1.3.4 1.3.5
New
User
Overview
Security
Groups
Management
Console
Log
into
Compute
Instance
SSH
into
Instance
Using
Putty
Getting
Prompted
for
Password
When
Accessing
first
time
Issues
with
Connecting
to
Instance
via
SSH
Logging
in
as
root
with
Ubuntu
How
to
SSH
from
One
Instance
to
Another
Using
the
Private
Interface
1.4 1.5
Images,
Distributions
and
Kernel
Upgrades
How
to
Change
an
Instances
Security
Groups
Creating
a
Second
Keypair
for
a
Second
User
Setting
Up
LAMP
Stack
on
Ubuntu
Instance
Block
Storage
Create
&
Manage
Volumes
Creating
First
Block
Storage
Volume
&
Attaching
it
Block
Storage
=
Best
Practices
Launching BitNami WebPack on HP Cloud Setup & Use CloudFuse Sending Outbound Email from Your HP Cloud Environment
3.3
3.3.1 3.3.2
3.4
3.4.1 3.4.2 3.4.3
API
Basics
Use
of
API
with
REST
Client
Compute:
API
(Using
a
REST
Client)
Useful
API
Reference
Material
Page 2
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 3
TheREALChrisAnderson.com
Chris Anderson
12/17/12
After you have signed up for the HP Cloud Public Beta, here are the next steps: 1. You should login to your Manage Console where you will see your Dashboard along with a menu at the top with Compute, Storage, and Account.
Compute: Here you will see the current Availability Zones in which you can create an Instance by clicking on the Activate Now button followed by Manage Servers to see your servers. Storage: Here you will see the current Availability Zones for the HP Cloud Object Storage where you can Activate and then Browse Containers Account: Here is where you can view and set your account settings including your billing information 2. Next step is to setup your Billing Information so you will want to click onAccount and then Add Payment Method. You will enter your billing information on this screen.
Page 4
TheREALChrisAnderson.com
Chris Anderson
12/17/12
3. Now you are ready to Activate the Services you want. On your Dashboard you will see the HP Cloud Compute Availability Zones and the HP Cloud Object Storage with an Activate Now button to the right.
Page 5
TheREALChrisAnderson.com
Chris Anderson
12/17/12
3. Once you have your Compute Services activated, here are some documents to assist you in creating your first keypair and instance: Getting Started: Creating a Keypair Getting Started: Creating Your First Instance Getting Started: How to SSH into your instance using Putty Getting Started: Authentication Though not required, I would recommend visiting this document on how to install the Python-Novaclient as it's a good tool for managing your instances:
Page 6
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Python-NovaClient - Linux Installation Python-NovaClient - Windows Installation Here is a link to our Knowledge-Base where you can search for documents on support topics: HP Cloud Knowledge-Base Here is a link to our Community Forum where you can pose questions that can be answered by either HP Cloud Support or our community of users: HP Cloud Community Forum
Page 7
TheREALChrisAnderson.com
Chris Anderson
12/17/12
The new management console now allows you to add, delete, and modify security groups. To access the page that allows you to work with security groups, click on the security groups link on the manage page.
Customers will start of with the 'default' security group. It will be configured to allow access to port 22, port 80, port 443, and icmp -1. Here is an example of a security group set up by a customer. Notice that you can add and delete security group rules from the management console.
Page 8
TheREALChrisAnderson.com
Chris Anderson
12/17/12
All modifications of security group rules are only put into action after you click the save changes button. Once you make a change to the security group rules and save the change, the change you made will immediately go into effect for all instances using that security group. Warning: Do not delete any security groups that are currently being used by an instance. Doing so will make the instance completely inaccessible. There is no way to reassign a security group to an instance, so be very cautious when deleting a security group. Here is an article discussing the most common ports and their functions:
Page 9
TheREALChrisAnderson.com
Chris Anderson
12/17/12
1. Locate the private key you saved as a .pem file using the Key Pairs article previously linked. 2. You can download Putty from their website here Download putty.exe and puttygen.exe:
3. Place putty.exe, puttygen.exe, and your private key (.pem file) on desktop
4. Open puttygen.exe
Page 10
TheREALChrisAnderson.com
Chris Anderson
12/17/12
a) Select Conversions then Import key b) Select your private key (.pem file) that you have saved on your desktop.
Page 11
TheREALChrisAnderson.com
Chris Anderson
12/17/12
c) Click Save private key d) Click Yes e) Name the file appropriately before saving. This will create 'myprivatekeyname.ppk' on your desktop. 5. Close Puttygen.exe 6. Open Putty.exe.
Page 12
TheREALChrisAnderson.com
Chris Anderson
12/17/12
a) In Host Name (or IP address) add the Fixed Public IP address from your instance:
b) Under Category: select Connection -> SSH -> Auth. Click Browse, locate and select 'myprivatekeyname.ppk'
Page 13
TheREALChrisAnderson.com
Chris Anderson
12/17/12
c) Go back to Session at the top of the Category column on the left. In Saved Sessions input the Instance ID, or whatever you'd like to name your instance, and click Save:
Page 14
TheREALChrisAnderson.com
Chris Anderson
12/17/12
7. You can now Open the session by highlighting your instance under Saved Sessions and clicking Open: NOTE: You will get a pop-up box, just click YES
Page 15
TheREALChrisAnderson.com
Chris Anderson
12/17/12
NOTE: The default username for Ubuntu version 11.10 and after is "ubuntu". Any of the other images will use "root" as the default username. If you are being prompted a password upon first time log in, check over this doc: Getting prompted for a password when accessing your instance for the first time If you are able to login, you should see a screen similar to this:
Page 16
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 17
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Getting prompted for a password when accessing your instance for the first time
https://community.hpcloud.com/article/getting-prompted-password-when-accessing-your-instance-first-time By Holt G. (Cloud ..., 4 months 3 weeks ago
If you are running into the issue where you have just created an instance and cannot log in as root or ubuntu because the VM is asking for a password by default, this simply means there is an issue with the keypair file (.pem or .ppk) you are using to connect with. NOTE: When you connect to certain VM images, such as CentOS, if you connect via putty or SSH with the wrong .pem or .ppk, it may not necessarily explicitly tell you the key was rejected. What the VM will do in this situation is give a "silent error" and default to asking for a password as a default security measure. The two things to check are: 1. If you are using Putty, load up your instance settings and ensure that the keypair is loaded under Connection > SSH > Auth > Private key file for authentication. 2. Make sure that the .pem or .ppk key file was made correctly, and remake it if needed: Getting Started: Creating a Keypair If you do make a new keypair, then you will have to make a new instance with the new keypair as well, so the instance's keypair and the new .pem or .ppk keypair file match. Getting Started: Creating Your First Instance Getting Started: How to SSH into your instance using Putty
Page 18
TheREALChrisAnderson.com
Chris Anderson
12/17/12
If you are trying to connect to an instance, and you cannot SSH in, there are a few reasons this can happen. Here are some things to double check:
First and foremost, reboot the instance, and then give it another go! Try to ping the public IP of the instance. If you can't ping the public IP at all, double check that your proper security group ports are open. Here is how to open security group ports:https://connect.hpcloud.com/article/managementconsole-security-groups Make sure TCP ports 22,80,443 are open , as well as ICMP -1(these should all be open on the default group). You must reboot the instance for security group changes to take effect If you can ping the public IP but still can't sucessfully SSH, make sure you are using the correct keypair. Make sure the keypair listed in the management console for that instance matches the .pem or .ppk file you are using. If you are unsure if you made your .pem or .ppk key right, then simply run through this to make sure:https://connect.hpcloud.com/article/creating-keypair If you are trying to SSH from a terminal line, make sure the .pem key file is sitting in your current directory that you are trying to connect from
Page 19
TheREALChrisAnderson.com
Chris Anderson
12/17/12
When first opening an instance of Ubuntu 11.10 with PuTTY, the login screen requires that you login as "ubuntu" not a Root user. 1.) Define a root user password, effectively creating the user.
sudo passwd root
2.) A prompt for the new password and retyping it will appear.
4.) Enter your password and now you are in the root user for this session.
to jump into root. This will be a persistant root login. Note: This practice is normally avoided to prevent unauthorized access.
Page 20
TheREALChrisAnderson.com
Chris Anderson
12/17/12
You can only SSH to an instance's private IP from another instance within the HP Cloud. If you are trying to connect to an instance from your local computer, you will need to use the public IP. The first step to connect to another instance via its private IP is getting your .pem keypair file to your instance, to do this follow these steps: 1. Activate your HP Cloud Object Storage, if you haven't already, and upload your .pem file for the instance you are using. You can create a container named "Keypairs" if it helps you keep it organized: How to upload a file to your container using the Manage Console 2. Once your file is uploaded, in order to get the file to your instance you will need to make the container Public with these instructions: SECURITY NOTE: When your container is made public, anyone with the Public URL will be able to access your file so once you are done uploading your .pem file to the instance please ensure that you make your container private again a) Click on the i next to your container which will bring up the Options and Info on the right side b) Click on the Make Public button
Page 21
TheREALChrisAnderson.com
Chris Anderson
12/17/12
c) Click on your container to bring up your list of files, then click on the i next to your .pem file which will bring up the Options and Info on the right side again d)You will see your Public URL for the file at the bottom, you will need this to get the file to your instance 3. SSH into your source instance and run the following command to bring your .pem file into your instance:
wget PublicURL
Page 22
TheREALChrisAnderson.com
Chris Anderson
12/17/12
5. With your .pem file now uploaded to your source instance, run the following command to ensure your key is protected:
chmod 400 File_Name.pem
6. Then you can run this command to SSH into your target instance:
ssh -i File_Name.pem root@Private_IP
You can use either your Public IP or your Private IP, the Private IP will usually result in a faster connection. Example:
ssh -i AZ2.pem root@10.185.178.186
It will prompt you for your password, once that is entered you will be in your target instance.
Page 23
TheREALChrisAnderson.com
Chris Anderson
12/17/12
TightVNC coupled with Gnome, KDE, or other options is a way for your to access a desktop GUI for your instance. These are 3rd party tools and while we are providing you some working examples in this document please understand that these are not officially supported. We will always do our best to assist you if you run into issues though so don't hesitate to reach out to Supportif you need assistance. You can find a lot of great resources on the internet for setting up VNC on Linux! NOTE: Prior to these instructions you will need to open port 5901 on your security groups. Please ensure that once you open up Port 5901 that you reboot your instance as well. Instructions can be found here. There are two steps to setting up a remote desktop. Step 1 - Installing & Setting up the VNC Server on your HPCloud Instance Step 2 - Installing & Setting up the VNC Viewer on your Local Machine
Step 1 - Installing & Setting up the VNC Server on your HPCloud Instance Using Ubuntu 11.04 & Debian Squeeze:
sudo apt-get update sudo apt-get install gnome-desktop-environment x-window-system-core sudo apt-get install tightvncserver sudo vncserver
It will then prompt you to create a password that will be needed to access your remote desktop: Password: YourPassword Verify: YourPassword
Page 24
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Once you enter the password and your vnc configurations are complete, it will display what path the startup file had been written to as shown below. Take note of this startup file path location, you will need it for the next couple steps. Here is the example output showing were the vnc startup file has been written to:
Next, shut down the vnc server to further configure the startup file:
vncserver -kill :1
Take note of the path name displayed for the startup file, because you will need it for the following step, and it will vary image to image. Open the startup file using the same path displayed right after you entered a password for tightvnc. Here is an example of opening the startup file with the previously stated path:
sudo nano /root/.vnc/xstartup
Add the following two lines to the bottom of the startup file:
unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc
Page 25
TheREALChrisAnderson.com
Chris Anderson
12/17/12
sudo vncserver
It will then prompt you to create a password that will be needed to access your remote desktop: Password: YourPassword Verify: YourPassword Once you enter the password and your vnc configurations are complete, it will display what path the startup file had been written to as shown below. Take note of this startup file path location, you will need it for the next couple steps. Here is the example output showing were the vnc startup file has been written to:
Next, shut down the vnc server to further configure the startup file:
vncserver -kill :1
Take note of the path name displayed for the startup file, because you will need it for the following step, and it will vary image to image. Open the startup file using the same path displayed right after you entered a password for tightvnc. Here is an example of opening the startup file with the previously stated path:
sudo nano .vnc/xstartup
Erase everything in the file and replace it with the following text:
#!/bin/sh unset SESSION_MANAGER gnome-session --session=gnome-classic & [ -x
/etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic &
Page 26
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Using CentOS 5.6 or 6.2: CentOS has provided step-by-step instructions on their Wiki page: CentOS - How To - VNC Server Skip down to Step #2 at the bottom
Using Fedora:
yum update yum install tigervnc-server yum groupinstall "Desktop" "X Window System" "Fonts" vncserver
It will then prompt you to create a password that will be needed to access your remote desktop: Password: YourPassword Verify: YourPassword Run this to kill your current session:
vncserver -kill :1
Now we need to edit the VNC startup file: nano /root/.vnc/xstartup Erase the entire contents of the file and replace with this:
Page 27
TheREALChrisAnderson.com
Chris Anderson
12/17/12
#!/bin/sh unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources startkde &
Step 2 - Installing & Setting up the VNC Viewer on your Local Machine Using Ubuntu & Debian Squeeze:
sudo apt-get update sudo apt-get install xtightvncviewer xtightvncviewer
You will need to input the password you used when setting up your remote desktop on the instance. VNC Server: PublicIPAddress:1 Password: YourPassword Example:
VNC Server: 15.185.1.1:1 Password: password
Using Windows O/S: 1. Download and Install Tight VNC Viewer (Right-click, save as the link or you can go to the TightVNC Download page and choose the Self-installing Package for Windows download) 2. Open Tight VNC Viewer
Page 28
TheREALChrisAnderson.com
Chris Anderson
12/17/12
You will need to input the following information: VNC Server: PublicIPAddress:1 Password: YourPassword Example:
VNC Server: 15.185.1.1:1 Password: password
Page 29
TheREALChrisAnderson.com
Chris Anderson
12/17/12
It is best practices to take regular snapshots (images) of your instances, especially before making big changes. It's similar to doing a System Restore to a particular restore point in Windows or using Time Machine on a Mac. The benefit to doing this is so that if something goes wrong with your instance, you will have the backup that you stored in the image. Here is information concerning how to create an image of your instance: Getting Started: Creating an Image of an Instance Our recommendation when taking images is to come up with a naming scheme so you can identify your image backups later. However, keep in mind that you should avoid using special characters in the names and just stick with alpha-numeric characters. Now that you have your image backups you can utilize the Server Rebuild command within the Novaclient CLI to rebuild your instances. You can find details about the Novaclient and the available commands here. You can use this command:
nova rebuild SERVER_ID IMAGE_ID
What that will do is rebuild the server using the Image ID that you specify. Try it out!
Page 30
TheREALChrisAnderson.com
Chris Anderson
12/17/12
2.6 Launching BitNami WebPack on HP Cloud 2.7 Setup & Use CloudFuse 2.8 Sending Outbound Email from Your HP Cloud Environment
Page 31
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Currently only certain images can have their distribution upgraded, due to the way the kernel is associated with the image. With some of the older images, the bootable kernel lives externally from the image itself, so when a user tries to upgrade the distribution or kernel on one of these images, the kernel will upgrade internally on the instance but the instance will boot looking at the external older kernel. Because of this, the VM may become inaccessible after. However, there are images that can have the distribution and kernel upgraded, because the kernel for these images lives inside the image itself. The following steps will show you the way to find out which of these images support a distribution and kernel upgrade. 1. First, set up the NOVA API: Python-Novaclient API Installation Instructions 2. Once that is done, type the command
nova image-list
Page 32
TheREALChrisAnderson.com
Chris Anderson
12/17/12
3. As you can see from the nova output, some of the images have 3 parts to them: the kernal, the ramdisk, and the image itself.
The images with the kernel and ramdisk options are the ones that do notsupport kernel or distribution upgrades, such as the Debian Squeeze and CentOS images shown by the above screenshot, because the nova image-list shows that the kernel is external from the image itself. The images that are listed without the kernel and ramdisk options, such as the Fedora 16 and Ubuntu Oneiric 11.10 images in the screenshot below, dosupport a kernel or distribution upgrade because the kernel is within the image itself.
Page 33
TheREALChrisAnderson.com
Chris Anderson
12/17/12
If you are ever unsure or want to just double check which one of these images can be upgraded, you can always contact our customer support for clarification. How To Contact Support for Assistance
Page 34
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Once an instance has been created it cannot be assigned to a new security group. However, if you wish to make port changes after the instance has been created, you can modify the default security group (or whichever security group the instance is associated with) and then reboot the instance for the port changes to take effect. The instance will then inherit the new rules of the security group it is using. You can also take a snapshot of a running instance via the Nova or Curl API (various other APIs can do this as well) and then recreate a new image from that snapshot with the security group you want to attach to that instance. NOVA documentation CURL documentation
Page 35
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Multiple users on an instance can always use the same default keypair to connect, but sometimes there are situations where a certain user may need their own specific keypair to connect as well. The below instructions will show the semantics on how to set up a keypair for one specific user. The below instructions were tested on CentOS 6.2, but the semantics should be extremely similar for other images as well. 1) Create a new user and create the .ssh directory in the new user's home path:
useradd testUser mkdir ~testUser/.ssh/
2) Generate a new keypair, and save the file with the desired name and location. This will then save two keys, a private key file and a .pub public key file: Generate a new keypair:
ssh-keygen -t rsa
3) Set the appropriate permissions for the new users .ssh directory and for the private key that was just made:
chmod 700 ~testUser/.ssh chmod 600 ~/myKeys/testKey
4) Copy the newly created public key file's information into the default users~/.ssh/authorized_keys file, and set the appropriate permissions. This will update the authorized_keys file and will give the new key access to that instance:
~/testKey.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
Page 36
TheREALChrisAnderson.com
Chris Anderson
12/17/12
5) Now that we added the key as an authorized key for the default user,we need to allow the new user to be able to user that new key as well. Simply copy the default authorized_keys file into the new users .ssh directory:
cp ~/.ssh/authorized_keys ~testUser/.ssh/authorized_keys
Note - In the new user's /.ssh/authorized_keys file, the default keypair data will be in that file as well. Simply remove the first data entry if you do not want the new user to be able to use the default keypair. Admin users can modify the new user's authorized_keys file as they see fit. 6) We also need to allow the new user to be able to read the data from that authorized keys file so it can accept the new keypair, by default only the root user may be able to read data from that file even though it is in the new user's .ssh directory:
chown -R testUser:root ~testUser/.ssh/
7) This is all that needs to be done! Now the new user has the new keypair data in their .ssh folder and they have the ability to read, access, and verify the key data from that file upon login. To be able to log in with the new key via putty, simply take that original private keyfile generated from step 2 (not the .pub), and use puttygen to convert it to a .ppk. You can find more info on puttygen within this document: https://community.hpcloud.com/article/getting-started-how-ssh-your-insta... Final Note - There are multiple other ways to create keypairs for specific users, but this is just one way of going about this. Admin users will need to set the permissions and place the key files wherever applicable, and will need to distribute their keys appropriately.
Page 37
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Verified to work with Ubuntu Natty 11.04 A LAMP stack (Linux, Apache, MySQL, and PHP) is a popular web development package with many possible uses. The steps below will setup the package on an Ubuntu instance. First, well update existing installs.
sudo apt-get update
This command will install all major components for the setup.
sudo apt-get install lamp-server^
Note: Please ensure youve included the caret. During the installation youll be asked to enter a password for the MySQL root user. Enter the password and verify by entering it again after hitting Enter.
Page 38
TheREALChrisAnderson.com
Chris Anderson
12/17/12
To verify the Apache web server installation was successful, enter your public IP address (15.X.X.X) into a web browser. If you receive the following message, it was installed properly. (NOTE-ensure port 80 is open on the public IP address.)
Page 39
TheREALChrisAnderson.com
Chris Anderson
12/17/12
If youd like to use the phpMyAdmin tool for MySQL administration use the following command.
sudo apt-get install phpmyadmin
During configuration you may be asked to choose which web server to have configure with phpMyAdmin as pictured below. Hit the space bar with "apache2" highlighted to select it, then hit Enter.
Page 40
TheREALChrisAnderson.com
Chris Anderson
12/17/12
You can visit 15.X.X.X/phpmyadmin to verify the tool is available. Next, to verify PHP is functioning properly, create a test page with the following:
vi /var/www/test.php
Then, point your browser to 15.X.X.X/test.php You should see a page that looks like this:
Page 41
TheREALChrisAnderson.com
Chris Anderson
12/17/12
You can now proceed to build your database driven webpage with your favorite web development method.
Page 42
TheREALChrisAnderson.com
Chris Anderson
12/17/12
NOTE: If you have Block Storage Volumes and you take Snapshots of them, if you delete the associated Volume then that Snapshot will become nonfunctional. Using Curl and Rest API: Current documentation can be found here: Block Storage Developer Guide Using the Python-Novaclient API: NOTE: Ensure you have the Python-Novaclient installed. Instructions can be found here nova volume-create Add a new volume.
nova volume-create --snapshot_id [SNAPSHOT_ID] --display_name [DISPLAY_NAME] -display_description [DISPLAY_DESCRIPTION] [SIZE]
NOTE: The volumes will not have filesystems setup on them after creation. For information on how to setup a filesystem on your volume after you've attached it to an instance, please see our Mounting Additional Space document and just tailor the commands to your specific needs. nova volume-delete Remove a volume.
nova volume-delete [VOLUME}
NOTE: A volume cannot be deleted if it is still attached to an instance. nova volume-attach Attach a volume to a server.
Page 43
TheREALChrisAnderson.com
Chris Anderson
12/17/12
NOTE: The only limit to how many volumes you can attach to an Instance will be your individual account quotas on how many volumes you can create. So if you want to attach 4 volumes, for example, to an instance you can. You will have to specify individual DEVICE_ID's to each one though. NOTE: When using CentOS or Debian Squeeze you should reboot your instance after attaching the volume in order for it to show in fdisk -l. NOTE ABOUT DEVICE_ID: You can use either /dev/sd(f-p) or /dev/vd(c-m) as your naming convention. For example "/dev/sdf" will translate to "/dev/vdc" if you look at your Instance after attaching. nova volume-detach Detach a volume from a server.
nova volume-detach [SERVER] [VOLUME]
Page 44
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 45
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Getting Started: Creating Your First Block Storage Volume and Attaching It
https://community.hpcloud.com/article/getting-started-creating-your-first-block-storage-volume-andattaching-it By Joel B (Cloud S..., 2 days 23 hours ago
This article will walk you through creating your first Block Storage Volume and then attaching it to one of your compute instances. For this walk-through we are going to use the Novaclient CLI. If you don't already have the Novaclient CLI installed, you can find installation instructions here: Getting Started: Managing Your Instances Using Novaclient After the Novaclient is installed and functioning, you are ready to start working with Block Storage! 1. You want to ensure that your Novaclient credentials are pointed to the Availability Zone (AZ) that your Block Storage is activated on. You do this by checking your Bash file, you can check which command to run via the Novaclient installation document linked in the introduction. 2. You can run this command to see the list of your current volumes, which should be empty:
nova volume-list
Output:
+----+--------+--------------+------+-------------+ | ID | Status | Display Name | Size | Attached to | +----+--------+--------------+------+-------------+ +----+--------+--------------+------+-------------+
3. You can now create a new volume using this command: This is the base command without the variables set:
nova volume-create --display_name [DISPLAY_NAME] --display_description [DISPLAY_DESCRIPTION] [SIZE]
Page 46
TheREALChrisAnderson.com
Chris Anderson
12/17/12
This is an example command that will create a 1 GB Volume with Display Name "BockTest":
nova volume-create --display_name BockTest 1
Output:
+------+-----------+--------------+------+-------------+ | ID | Status |
Display Name | Size | Attached to | +------+-----------+--------------+------+------------+ | 1323 | available | BockTest | 1 | None | +------
+-----------+--------------+------+-------------+
You will see the following columns: ID - this is the Volume ID, for use in subsequent commands Status - this is the current status of the volume, you will see Available, Attaching, In-Use, or Error Display Name - this is the display name that you chose when you created it Size - this is the size you specified, in GB Attached to - this will list the Instance ID that it's attached to, or None if it's unattached 4. Now you will want to find the Instance you want to attach it to:
nova list
Sample Output:
+--------+---------------------------------------+--------+------------------------------------+ | Networks ID | Name | Status |
| +--------+---------------------------------------+-----
5. Now for the attach command: This is the base command without the variables set:
Page 47
TheREALChrisAnderson.com
Chris Anderson
12/17/12
This is an example command that will attach the Volume we created earlier to the Instance in Step #3:
nova volume-attach 2907XX 1323 /dev/vdc
That will attach the Volume to the Instance at the location you specify, in my example I attached it to /dev/vdc but you can attach it to the location that you want. NOTE ABOUT DEVICE_ID: Prior to running nova volume-attach we recommend viewing your available devices on that instance by running fdisk l. This command will display all your current devices /dev/vda (root partition), /dev/vdb (additional storage) so you must select one that is not listed /dev/vdc /dev/vdd and so on. 6. Now if you run the volume list command you should see the following output:
nova volume-list
Output:
+------+-----------+--------------+------+-------------+ | ID | Status |
Display Name | Size | Attached to | +------+-----------+--------------+------+------------+ | 1323 | in-use | BockTest | 1 | 2907XX | +------+-
----------+--------------+------+-------------+
7. If you SSH into your Instance and run an fdisk command you should see your Volume:
fdisk -l
Sample Output:
Page 48
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Disk /dev/vdc: 1073 MB, 1073741824 bytes 16 heads, 63 sectors/track, 2080 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Disk /dev/vdc doesn't contain a valid partition table
That is what the example Volume looks like when it's first attached. Notice that it doesn't have a filesystem setup on it yet so you will need to partition and setup a filesystem on it to use it. 8. We've written a detailed knowledge-base article on setting up a filesystem that includes examples depending on the O/S of the instance you attached the Volume to. You can view it here, just be mindful of replacing the variables with the variables that match your situation: Mounting Additional Space After you've partitioned and setup a filesystem on your volume, you will an output similar to this:
Disk /dev/vdc: 1073 MB, 1073741824 bytes 16 heads, 63 sectors/track, 2080 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Start 2080 End 1048288+ 83 Blocks Linux Id System /dev/vdc1 Device Boot 1
9. There are a couple of things you can do at this point: a) If you need more than one Block Storage volume attached to your instance, you can repeat these steps to attach a second volume to the same instance. You could use DEVICE_ID /dev/vdd, for example. b) If you want to detach this volume from the current instance and attach it to a different instance you could do that as well. We'll show you how in the next step! 10. So right now your Volume has a status of In-Use:
+------+-----------+--------------+------+-------------+ | ID | Status |
Display Name | Size | Attached to | +------+-----------+--------------+------+------------+ | 1323 | in-use | BockTest | 1 | 2907XX | +------+-
----------+--------------+------+-------------+
In order to detach the volume you would use the following command: This is the base command without the variables set:
Page 49
TheREALChrisAnderson.com
Chris Anderson
12/17/12
This is an example command that will detach the Volume we created earlier to the Instance in Step #5:
nova volume-detach 2907XX 1323
Now if you run the Nova volume-list command you will see the following:
nova volume-list
Output:
+------+-----------+--------------+------+-------------+ | ID | Status |
Display Name | Size | Attached to | +------+-----------+--------------+------+------------+ | 1323 | available | BockTest | 1 | 2907XX | +-----
-+-----------+--------------+------+-------------+
11. The last thing we'll show you how to do is how to take a snapshot of your volume so that you can create new, identical, volumes. NOTE: Two things to keep in mind when doing snapshots: a) Your volume has to be detached and in available status in order for you to take a snapshot of it. You will receive an error if you try to snapshot a volume that's in-use. b) You must keep the original volume that you take the snapshot of in order for the snapshot to function properly. If you delete the original volume then the snapshot will become unusable. This is the base command without the variables set:
nova volume-snapshot-create --force [TRUE or FALSE] --display_name [DISPLAY_NAME] --display_description [DISPLAY_DESCRIPTION] [VOLUME_ID]
This is an example command that will snapshot the Volume we created earlier to the Instance in Step #3:
nova volume-snapshot-create --display_name SnapTest 1323
Page 50
TheREALChrisAnderson.com
Chris Anderson
12/17/12
12. Now you can view your Snapshots using this command:
nova volume-snapshot-list
Output:
+-----+-----------+----------------+--------------+------+ | Status ID | Volume ID |
-+-----------+----------------+--------------+------+
As you can see you have a new column with this command which shows you the Volume ID that the snapshot is based on. This is so you can reference it later if you need to! 13. Finally, if you want to create a NEW volume using that snapshot as a base, you would use this command: This is the base command without the variables set:
nova volume-create --snapshot_id [SNAPSHOT_ID] --display_name [DISPLAY_NAME] -display_description [DISPLAY_DESCRIPTION] [SIZE]
This is an example command that will create a new volume from the snapshot we created earlier in Step #11:
nova volume-create --snapshot_id 131 --display_name BockTest_Snap2 1
| +------+-----------+--
As you can see, we have the original Volume ID 1323 which we created in Step #3 and now we have new Volume ID 1417 which we created from
Page 51
TheREALChrisAnderson.com
Chris Anderson
12/17/12
the snapshot from Step #11. So we have two identical Block Storage Volumes to work with. You can repeat these steps as necessary for the configuration you need. You can also use our Block Storage documentation for a full command list: Block Storage: Creating & Managing Volumes
Page 52
TheREALChrisAnderson.com
Chris Anderson
12/17/12
We have added notes in our Block Storage: Creating & Managing Volumesarticle, but here are some other known issues and best practices you should observe: 1. Only use alpha-numeric characters in the display names of volumes. 2. After attaching a Block Storage volume to an instance, you may need to reboot that instance prior to that volume being accessible. This is necessary on CentOS 5.6 and Debian Squeeze instances but it's a good practice to observe on all instances. 3. On CentOS 5.6, if you attach a volume to a mount point, such as /dev/vdc, and then detach the volume and reattach it back to the same mount point, back to /dev/vdc, then the volume may get stuck in attaching. There are various known issues with CentOS 5.6 in regards to block storage at this time, so please use centOS6.2 for block storage functions in the mean time. 4. The only limit to how many volumes you can attach to an Instance will be your individual account quotas on how many volumes you can create. So if you want to attach 4 volumes, for example, to an instance you can. You will have to specify individual DEVICE_ID's to each one though. NOTE ABOUT DEVICE_ID: Prior to running nova volume-attach we recommend viewing your available devices on that instance by running fdisk l. This command will display all your current devices /dev/vda (root partition), /dev/vdb (additional storage) so you must select one that is not listed /dev/vdg /dev/vdh and so on. eg: "nova volume attach 11480 8426 /dev/vdg" this attaches volume # 8426 to the Server ID with 11480 and assigns it the /dev/vdg.
Page 53
TheREALChrisAnderson.com
Chris Anderson
12/17/12
The BitNami WebPack image provides a pre-configured, ready to run bundle of the most popular open source web applications: WordPress, Joomla! and Drupal. It includes ready-to-run versions of Apache, MySQL, PHP and phpMyAdmin and required dependencies. It will allow you to deploy fully featured websites in minutes which you can later customize with thousands of plugins and addons available for these platforms. BitNami WebPack is distributed for free under the Apache 2.0 license. Getting started is simple. Sign up for the service at the HP Cloud site and select one of our BitNami WebPack install images when launching a server. The Security Group will need to have ports 80 (http) and 22 (ssh) open. The default login and password for all pre-installed BitNami applications WordPress, Joomla! and Drupal are:
* login: user * password: bitnami
Support for BitNami DevPack images is provided directly from BitNami via: Support: http://answers.bitnami.org/ More info:
http://bitnami.org/stack/webpack/ http://wiki.bitnami.org/HP_Cloud
Page 54
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Once the client has been installed, import the .ppk files into the key library. Select Edit and then select Settings.
Page 55
TheREALChrisAnderson.com
Chris Anderson
12/17/12
In the left pane, select SFTP and then select Add keyfile.
Page 56
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 57
TheREALChrisAnderson.com
Chris Anderson
12/17/12
To add a new site, select Site Manager from the tool bar or File menu.
Page 58
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Log in with whatever default user that particular instance accepts. It will typically be root, but for ubuntu 11.10 you will need to log in as ubuntu
Page 59
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 60
TheREALChrisAnderson.com
Chris Anderson
12/17/12
How to Install CloudFuse *Currently tested and working on: Ubuntu 10.10, Ubuntu 11.04 Step I Download s/w:
wget http://c16281.r81.cf2.rackcdn.com/cloudfuse-0.1.tar.gz
or you can download it via: https://github.com/redbo/cloudfuse. Step II You will need to install the following proper library files to get cloud fuse to work:
sudo apt-get update sudo apt-get install gcc sudo apt-get install libcurl4-openssl-dev sudo apt-get install libxml2 libxml2-dev sudo apt-get install libfuse-dev sudo apt-get install make
Page 61
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Step IV Next create a configuration file for CloudFuse in your home directory. This is where your HP cloudfile API key and username will reside.
sudo nano ~/.cloudfuse
EXAMPLE
username=11122233344455:holtg@gmail.com api_key=management console password authurl=https://region-a.geo-1.identity.hpcloudsvc.com:35357/auth/v1.0/
You should then be able to mount your cloud files by running the following commands:
mkdir cloudfiles cloudfuse ./cloudfiles
Side note about backwards compatibility For the config file you use
authurl=https://region-a.geo-1.identity.hpcloudsvc.com:35357/auth/v1.0/
You use v1.0 because CloudFuse doesn't support keystone. Once CloudFuse starts to support Keystone the authurl will become v2.
authurl=https://region-a.geo-1.identity.hpcloudsvc.com:35357/auth/v2.0/
Page 62
TheREALChrisAnderson.com
Chris Anderson
12/17/12
There are two ways to send outbound email from the HP Cloud environment, both using the functionality available through the SendGrid cloud-based email infrastructure utility:
SMTP relay Web API To help you decide which method to use, we recommend reading the SendGrid SMTP vs. Web API information. Your choice of implementation will depend on your particular application requirements. There are several account options open to HP Cloud users: Sendgrid starter, a free alternative for sending up to 200 messages a day, and several paid plansfor higher expected email volumes. See the SMTP Service Packages and Pricing page for full details. Please navigate to the Sendgrid sign-up link on your account page in the HP Cloud management console to get started with Sendgrid.
Page 63
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Use of API with REST Client Compute: API (Using a REST Client) Useful API Reference Material
Page 64
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Migrating to the new HP Cloud Identity Service With the introduction of the HP Cloud Identity Service, the days of keeping track of different sets of access keys for each individual service will soon be over. A much more sophisticated mechanism for managing access to services will soon be available This document explains how this significant but welcome change will affect you. It details the steps you need to take to make sure your HP Cloud Services remain functional and take advantage of this new authentication and access management process. Before getting started, we highly recommend that you read Introducing the HP Cloud Identity Service for a general overview of this new service. How am I impacted? The fundamental changes we are making to authentication will affect all current private beta customers. The most common changes that may affect you include:
Manage Console Login credentials (email address and password) remain exactly the same. However, the API Keys screen will now features a single set of Access Keys and Secret Keys and it will also display your Tenant ID and a Tenant Name along with the Service Endpoints available to you (Figure 1).
Page 65
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Figure 1
New endpoint for authenticating If you have written your own authentication code, you will need to interact with the new Identity Service endpoint and API. The endpoint is prominently displayed in the Manage Console as shown above (https://region-a.geo1.identity.hpcloudsvc.com:35357/v2.0/tokens). Detailed instructions for interacting with it are available in the HP Cloud Identity Service REST API documentation. Bindings and CLIs You will need to download new versions of the bindings and CLIs you are using. All HP-supported bindings and CLIs have been upgraded to interact with the new Identity Service. In many cases, the only impact after switching to the new version is that instead of using just access keys for authentication, you must now use access keys and your Tenant ID or Tenant Name. More details are provided later in this document. Service Endpoints for Object Storage and Compute Authentication for both Object Storage and Compute is now performed with the Identity Service, which will deliver a Service Catalog containing the endpoints for activated services. If you have written your own code on top of the raw REST API for
Page 66
TheREALChrisAnderson.com
Chris Anderson
12/17/12
either Object Storage or Compute, you should consult the Identity Service REST API documentation for more details. EC2 compatibility and 3rd party tools like Euca2ools Your endpoint wont change but you will need to change your access key. More details are provided later in this document. Interruption of services during the upgrade HP Cloud Services will be disrupted during the upgrade. We will post specific time information in the HP Cloud Services Console at least three days prior to the upgrade.
o o
HP Cloud Object Storage The service will be shutdown and unavailable during the upgrade. If you use the Object Storage API, you should use this time to change your endpoint as described below or upgrade to a new version of the CLI or language binding. HP Cloud Compute Compute instances will continue to run normally. You will be unable to use the Management Console or the Compute API to manage any instances until the upgrade is complete (i.e., you will not be able to create new instances, terminate existing instances or query the state of your instances). If you use the Compute API, use this time to change your endpoint as described below or upgrade to a new version of the CLI or language binding. HP-provided Bindings and CLIs All HP-provided bindings (Ruby Fog and Java jclouds) and CLIs (Unix and Windows Powershell) have been upgraded to work with the Identity Service and will be available on our website at the conclusion of the upgrade:
o o
http://build.hpcloud.com/bindings https://build.hpcloud.com/cli Upgraded documentation will also be available, but in most cases the biggest change is the need to provide a Tenant ID in addition to your Access Key ID when starting a session. Backward compatibility will be supported for a limited
Page 67
TheREALChrisAnderson.com
Chris Anderson
12/17/12
time in some instances. Examples include the Object Storage backward compatibility and EC2 compatibility API both of which are described below. Your Username is your email address - the address you use to log onto the HP Cloud Services Manage Console. Once the HP Cloud Identity Service is released your Tenant Name will be visible in the Manage Console (Figure 1). For most users your Tenant Name will be your email address with -defaulttenant appended to the end (e.g., sally.smith@hp.com-default-tenant). The exception is users whose HP Cloud Services accounts were active prior January 12th, 2012. For these users, the Tenant Name will simply be their email address. Product Specific Documentation can be found at: HP Cloud Object Storage Users HP Cloud Compute Users
Page 68
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Running Fog:
Using the Interactive Ruby application you can use HP's Fog binding. Examples of how to use Fog with our various services are provided within the links below.
HP Cloud Fog library - Object Storage Examples HP Cloud Fog library - Compute Examples HP Cloud Fog library - CDN Examples
Page 69
TheREALChrisAnderson.com
Chris Anderson
12/17/12
HP Cloud Unix CLI - Object Storage Examples HP Cloud Unix CLI - Compute Examples HP Cloud Unix CLI - CDN Examples
Page 70
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Prior to installing the HP Cloud CLI, you will need to ensure that the Ruby Fog gem is installed properly. You can view those installation instructions here: HP Cloud Services Ruby Fog Binding Installation You can then proceed to install the HP Cloud CLI using these installation instructions: HP Cloud Services UNIX CLI Installation There are Compute, Object Storage, and CDN Examples and a FAQ on our documentation website here: Unix Command Line Interface
Page 71
TheREALChrisAnderson.com
Chris Anderson
12/17/12
You can view all of our Windows Powershell CLI documentation here We have written up some detailed HPCloud Windows Powershell CLI installation instructions which can be found here: Part I : Microsoft .NET Framework 4 & HPCloud Powershell CLI Installation Part II: Powershell Credentials Setup
Page 72
TheREALChrisAnderson.com
Chris Anderson
12/17/12
This document is broken up into two sections. The first section concerns itself with initial installation. The second part is concerned with installing the credentials via Windows Powershell. Part I : Microsoft .NET Framework 4 & HPCloud Powershell CLI Installation Part II: Powershell Credentials Setup STEP 1: Installing the Microsoft .NET Framework 4.0 which is a prerequisite: 1. Upgrade to the Microsoft .Net framework 4.0. The following screenshots show the progression for the installation to .Net 4.0.30319 for both the 32 and 64 bit versions (1st is 32 bit version)
Page 73
TheREALChrisAnderson.com
Chris Anderson
12/17/12
2. Starting the .Net install to 4.0.30319. The necessary files are located at http://www.microsoft.com/net/. Click on the button labeled:
Page 74
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 75
TheREALChrisAnderson.com
Chris Anderson
12/17/12
4. Verify that the .Net framework was upgraded to the 4.0.30319 version. 32 bit 4.0.30319
Page 76
TheREALChrisAnderson.com
Chris Anderson
12/17/12
STEP 2: Installing the HPCloud Windows Powershell CLI: NOTE: You can find additional screenshots of the following steps here 5. Download the Installer Package here 6. Extract the file to a directory 7. Open the file and run setup.exe
Page 77
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 78
TheREALChrisAnderson.com
Chris Anderson
12/17/12
9. Either accept the default location or choose the directory to install the files into.
Page 79
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 80
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 81
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 82
TheREALChrisAnderson.com
Chris Anderson
12/17/12
This document is broken up into two sections. The first section concerns itself with initial installation. The second part is concerned with installing the credentials via Windows Powershell. Part I : Microsoft .NET Framework 4 & HPCloud Powershell CLI Installation Part II: Powershell Credentials Setup Step 1: Setting Up & Configuring Powershell: 1.) Click on Start->All Programs->Accessories-> Windows Powershell>Powershell ISE (x86). The Powershell ISE x86 window:
Page 83
TheREALChrisAnderson.com
Chris Anderson
12/17/12
2. Click File->Open. Browse to: C:\Program Files (x86)\HP\HPCSPowershellOpen the file Climanifest.psd1.
After the climanifest.psd1 file is loaded, the tab should display the program script:
Page 84
TheREALChrisAnderson.com
Chris Anderson
12/17/12
4. It will prompt you for some information including your Access Key and Secret Key. These values will be located on your API Keys page. Further help on finding your authentication values can be found here.
Then it will go the Ready prompt and you are ready to start using Powershell. AComplete Command Line Reference is available to you.
Page 85
TheREALChrisAnderson.com
Chris Anderson
12/17/12
2. Install Python-setuptools:
apt-get install -y git python-setuptools
NOTE: If you receive a notice that it's already installed that's fine, this is just to ensure that it is. 3. Install the latest version of 'swift' using the 'easy_install' command:
sudo easy_install swift
4. You now need to set some environmental variables for the 'swift' command:
sudo nano ~/.bashrc
Page 86
TheREALChrisAnderson.com
Chris Anderson
12/17/12
. ~/.bashrc
You now have access to the swift command. Here is a reference document for Swift commands.
2. Install Python-setuptools:
apt-get install python-setuptools
NOTE: If you receive a notice that it's already installed that's fine, this is just to ensure that it is. 3. Install the latest version of 'swift' using the 'easy_install' command:
easy_install swift
4. You now need to set some environmental variables for the 'swift' command:
nano ~/.bashrc
Save the file and exit nano. 5. Source your .bashrc file.
Page 87
TheREALChrisAnderson.com
Chris Anderson
12/17/12
. ~/.bashrc
You now have access to the swift command. Here is a reference document for Swift commands.
CentOS 6.2 On CentOS, both Python 2.6.6 and the Python-Setuptools 0.6.10 are already installed by default 1. Ensure your software is updated:
sudo yum -y update
You now have access to the swift command. Here is a reference document for Swift commands.
Page 88
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Fedora 16 On Fedora 16, both Python 2.6.6 and the Python-Setuptools 0.6.10 are already installed by default 1. Ensure your software is updated:
sudo yum -y update
You now have access to the swift command. Here is a reference document for Swift commands.
Page 89
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Please see the Installing Swift CLI for Ubuntu, Debian, CentOS, and Fedora for installation. Functional Commands swift -h Helpfile - shows available functions
swift -h
swift list Lists the containers for the account or the objects for a container. -p or --prefix is an option that will only list items beginning with that prefix. -d or --delimiter is option (for container listings only) that will roll up items with the given delimiter
swift list
swift stat [container] [object] Displays information for the account, container, or object.
swift stat Test
swift post [options] [container] [object] Updates meta information for the account, container, or object depending on the args given. If the container is not found, it will be created automatically; but this is not true for accounts and objects. Containers also allow the -r (or -read-acl) and -w (or --write-acl) options. The -m or --meta option is allowed on all and used to define the user meta data items to set in the form Name:Value. This option can be repeated. Example: post -m Color:Blue -m Size:Large
Page 90
TheREALChrisAnderson.com
Chris Anderson
12/17/12
swift upload [Container file or directory] [file or directory to be uploaded] Uploads to the given container the files and directories specified by the remaining arguments. -c or --changed is an option that will only upload files that have changed since the last upload. -S or --segment-size and --leavesegments are options as well
swift upload Test http://example.com/test.zip
Note - To upload a file larger than 5GB via SWIFT, the file must be chunked:https://community.hpcloud.com/article/file-chunking-object-storage swift download --all OR download container [options] [object] [object] Downloads everything in the account (with --all), or everything in a container, or a list of objects depending on the args given. For a single object download, you may use the -o [--output] option to redirect the output to a specific file or if "-" then just redirect to stdout.
swift download Test
swift delete --all OR delete container [--leave-segments] [object] [object] Deletes everything in the account (with --all), or everything in a container, or a list of objects depending on the args given. Segments of manifest objects will be deleted as well, unless you specify the --leave-segments option.
swift delete Test
Page 91
TheREALChrisAnderson.com
Chris Anderson
12/17/12
The Python-Novaclient CLI, simple referred to as Novaclient, is an easy to use tool to manage your HP Cloud Compute instances. You can do everything from instance creation, management, and deletion with this one tool. We consider it Best Practice to install the Novaclient on your local machine even if you want to use the Manage Console for day-to-day operations because there is some functionality that exists in the Novaclient that doesn't exist elsewhere at this time. While troubleshooting with Support you will often find us referring you to the Novaclient to resolve issues so it's a good idea to have it installed! We have both Windows and Linux Installation instructions for you to use: Python-NovaClient Windows Installation Python-NovaClient - Linux Installation We also have a full list of available commands in this reference for you to use: Python-NovaClient Commands
Page 92
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 93
TheREALChrisAnderson.com
Chris Anderson
12/17/12
7. Scroll to the bottom of your Bash file and enter these variables:
export NOVA_USERNAME=EMAIL_LOGIN export NOVA_PASSWORD=PASSWORD export NOVA_PROJECT_ID=TENANT_NAME export NOVA_URL=https://region-a.geo1.identity.hpcloudsvc.com:35357/v2.0/ export NOVA_VERSION=1.1 export NOVA_REGION_NAME=az-1.region-a.geo-1
NOTE: The last export statement is to set up NOVA to communicate with instances on AZ1. To get NOVA to work on AZ2 or AZ3, simply change the last export statement to the appropriate AZ, for example:
export NOVA_REGION_NAME=az-2.region-a.geo-1
NOTE: If you need assistance finding the values for these variables, please see your API Keys page on your Account 8. Exit and Save your Bash file 9. Source your Bash file:
source .bashrc
You now have access to the nova command. Click here to see a list of the Novaclient commands that are currently compatible with our service.
CentOS 6.2 On CentOS, both Python 2.6.6 and the Python-Setuptools 0.6.10 are already installed by default
Page 94
TheREALChrisAnderson.com
Chris Anderson
12/17/12
7.Change your directory and edit your .bashrc file with your credentials:
cd .. sudo nano .bashrc
Page 95
TheREALChrisAnderson.com
Chris Anderson
12/17/12
NOTE: The last export statement is to set up NOVA to communicate with instances on AZ2. To get NOVA to work on AZ1, simply change the last export statement to
export NOVA_REGION_NAME=az-1.region-a.geo-1
9. Exit and save the file 10. Source your .bashrc file:
source .bashrc
You now have access to the nova command. Click here to see a list of the Novaclient commands that are currently compatible with our service.
Fedora 16 On Fedora 16, both Python 2.6.6 and the Python-Setuptools 0.6.10 are already installed by default 1. Ensure your software is updated:
sudo yum -y update
Page 96
TheREALChrisAnderson.com
Chris Anderson
12/17/12
NOTE: The last export statement is to set up NOVA to communicate with instances on AZ2. To get NOVA to work on AZ1, simply change the last export statement to
export NOVA_REGION_NAME=az-1.region-a.geo-1
You now have access to the nova command. Click here to see a list of the Novaclient commands that are currently compatible with our service.
Page 97
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 98
TheREALChrisAnderson.com
Chris Anderson
12/17/12
3. Go to your Control Panel\System and Security\System --> Go into Advanced System Settings
Page 99
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 100
TheREALChrisAnderson.com
Chris Anderson
12/17/12
6. Append ";c:\Python27\" (or your chosen installation directory of Python) to the Path variable --> Click OK --> Click OK
Page 101
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Download ez_setup.py
2. Under Control Panel\System and Security\System Go into Advanced System Settings Click on 'Enviroment Variables' under the Advanced tab Highlight the Path variable and click the "Edit..." button Append "C:\Python27\Scripts" (or whatever directory the easy_install.exe file is located in) to the Path variable -->Click OK -->Click OK 3. Open up a browser and go to https://github.com/openstack/pythonnovaclient Download the zipped folder and extract the folder
Page 102
TheREALChrisAnderson.com
Chris Anderson
12/17/12
4. In command line go to the location of the setup.py in the extracted folder and run:
python setup.py install
Page 103
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Examples of API are found here. Using API calls are easily assisted with the use of a REST client. Dependent on your browser and OS, there are quite a few options: REST Client for Firefox rest-client (multiple OS) Simple REST Client (Chrome Browser) Advanced REST Client (Chrome Browser) This document will be showing use of API with the REST Client for Firefox. The REST Client for Firefox:
Plugging in the API calls into into this application will allow an easy to use, GUI environment. This also allows the saving of API calls for later use. From the dropdown menu, choose a method (the verb):
Page 104
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Then put in your URI and request header. Not in all cases, but most of them, you'll need a request body. In the example below (for authorization token generation) you do need a request body:
The green bar in the above image (in the response body) notes that the authorization call was successful.
Page 105
TheREALChrisAnderson.com
Chris Anderson
12/17/12
For API calls that are using an authorization token, if the token is up to date, it will give a return resulting in a 401 error:
For general HPCloud API information, click here For general OpenStack API information, click here
Page 106
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Compute: API Examples for the purpose of these examples we used Availability Zone 1 (AZ1) Note: For Content-Type ensure you put application/json. For more information about REST Client go here.
Authorization token: Verb: POST URI: https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens Request Header: Content-Type Request Body:
{ "auth": { "passwordCredentials": { }, "username": "ACCOUNTEMAIL", } }
"password": "ACCOUNTPASSWORD"
"tenantId": "TENANTID"
Page 107
TheREALChrisAnderson.com
Chris Anderson
12/17/12
List Flavors: Verb: GET URI: https://az-1.region-a.geo1.compute.hpcloudsvc.com/v1.1/TENANTID/flavors Request Header: X-Auth-Token, Content-Type No Request Body
Page 108
TheREALChrisAnderson.com
Chris Anderson
12/17/12
List Images: Verb: GET URI: https://az-1.region-a.geo1.compute.hpcloudsvc.com/v1.1/TENANTID/images Request Header: X-Auth-Token, Content-Type No Request Body
Create Server: Verb: POST URI: https://az-1.region-a.geo1.compute.hpcloudsvc.com/v1.1/TENANTID/servers Request Header: X-Auth-Token, Content-Type Request Body:
{"server": {"name": "NAME", "imageRef": "IMAGE", "key_name": "KEYPAIRNAME", "flavorRef": "FLAVOR", "security_groups": [{"name": "default"}], "metadata": {"METADATATITLE" : "METADATA"}}}
Page 109
TheREALChrisAnderson.com
Chris Anderson
12/17/12
For more information concerning API for Compute, please go to our documentation page and view the Developer Guide:https://docs.hpcloud.com/compute/api
Page 110
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 111
TheREALChrisAnderson.com
Chris Anderson
12/17/12
HP Cloud Object Storage provides a way to store and retrieve objects in a highly redundant cluster of publicly accessible physical machines hosted in HP data centers. Key terms include: Object - The basic storage entity, most typically a file Container - A compartment for storing Objects The first thing you are likely to see once you activate your Object Storage is theManage Console GUI where you can manage your containers. There is currently a 50MB max file size limitation when uploading using the Manage Console so you may want to consider using some of the other tools we mention lower in this document. However, here are some documents to assist you in using the Manage Console for managing your Object Storage: Uploading files to your storage using the Manage Console Updating Content Type Settings for your Storage Files Our recommendation is, if you plan on using the Object Storage heavily, to leverage some of the 3rd party tools available that integrate well with our service. You can view the documents below and choose which one you think would suit you the best:
Cloudberry
Cloudberry Installation Cloudberry Functions
Cyberduck
Cyberduck Installation and Use
Gladinet
Gladinet Installation and Use
Page 112
TheREALChrisAnderson.com
Chris Anderson
12/17/12
For more advanced users, we also have API and CLI access you may want to use:
Swift CLI
Swift CLI - Linux Installation Swift CLI Commands
Page 113
TheREALChrisAnderson.com
Chris Anderson
12/17/12
CDN (Content Delivery Network) allows a user to enable higher download speeds of hosted files. This is possible due to servers deployed across the world, allowing downloads of the user's files from a server that is in closer proximity, permitting much faster speeds. At an additional fee, the user can enable CDN for their object storage. This service can be activated on the user's management page. 1. Open your Object Storage and select the i next to your container name. This will bring up the Options and Info pane.
2. You can choose to make your container Public which would make it accessible via the Public URL that will populate. You can toggle this back to Private at any time. You can also choose to Activate CDN on the container which will provide you with both a CDN URI and a CDN SSL URI, which can you also toggle to Disable CDN at any time.
Page 114
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Once you have activated CDN on an Object Storage container, you will see both a CDN URI and a CDN SSL URI for both the container and all objects inside that container.
Page 115
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Our CDN Service will allow you to register a CNAME record with whomever hosts your DNS so you can use custom URLs for your HP Cloud Object Storage. If you need further assistance with this, you can contact Support or you can take your CDN URIs and contact your DNS Host. For more information: About CDN & CDN API
Page 116
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Compressing Files
https://community.hpcloud.com/article/compressing-files By Nick Wade, 6 months 3 weeks ago
tar .tar allows folders and files to be put into a single .tar file, although uncompressed. (TAR-NAME is assumed that you name the file with .tar on the end.) Tar a file:
tar cvf TAR-NAME FILE FILE
Tar a folder:
tar cvf TAR-NAME FOLDER/
tar.gz .gz (or gzip) is the first form of compression. Tar compression (leave out object name to compress whole folder):
tar cvfz TAR-NAME.gz FOLDER/OBJECT
Listing contents:
tar tvzf TAR-NAME.gz
Page 117
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Uncompress:
ar xvfz .gz
tar.bz This method of .tar allows compression but at times can achieve smaller compression sizes. Compress (leave out object name to compress whole folder):
tar cvjf TAR-NAME.bz2 FOLDER/OBJECT
Listing contents:
tar tvjf TAR-NAME.bz2
Extracting:
tar xvjf TAR-NAME.bz2
add a directory
tar rvf TAR-NAME FOLDER/
Deleting folders:
tar --delete -vf TAR-NAME FOLDER/
Excluding files:
Page 118
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Exclude list: (make a list called 'exclude.txt' with the names of the files you wish to exclude)
tar cvf TAR-NAME -X exclude.txt FOLDER/
Page 119
TheREALChrisAnderson.com
Chris Anderson
12/17/12
When trying to upload any file larger than 5GB via the API or SWIFT, the file must be chunked into segments that do not exceed 2GB per chunk. You can do this via the API itself or a tool such as SWIFT. For API file chunking, see section 3.3.2.1 in our object storage documentation: http://api-docs.hpcloud.com/hpcloud-object-storage/1.0/hpcloud-object-st... To chunk and upload files using the SWIFT tool, you must first install SWIFT on the instance hosting the files you wish to upload following this document: https://community.hpcloud.com/article/installing-swift-cli-ubuntu-debian... Once SWIFT is installed, simply use the SWIFT upload command followed by a -S to signify the segment size (in bytes) of each chunk:
swift -v upload [CONTAINER] [filePath] -S [SEGMENTSIZE]
For example, the following command is uploading the file named bigFile2 into the ChunkTest object storage container, chunking it at 2GB per chunk (2147483648 bytes):
swift -v upload ChunkTest ./bigFile2 -S 2147483648
Once the file starts uploading, you will see the confirmation as each chunk is successfully uploaded:
Page 120
TheREALChrisAnderson.com
Chris Anderson
12/17/12
To learn more about additional SWIFT commands, see this document: https://community.hpcloud.com/article/swift-cli-commands
Page 121
TheREALChrisAnderson.com
Chris Anderson
12/17/12
CloudBerry allows the user to interact with the HP Cloud Storage. This is a drag and drop interface. Download here. Setup: 1. Get CloudBerry for Openstack (build 1.0.0.34):
2. Install CloudBerry for Openstack (the image below is what you'll see after initial launch). Then add your HP Cloud Storage Credentials.
Page 122
TheREALChrisAnderson.com
Chris Anderson
12/17/12
3. Go to File > HP Cloud Account (or OpenStack Account works as well): 4. Enter your authentication info: Display Name: User defined, it can be anything User name: TENANT_ID:EMAIL_LOGIN Api key: MANAGE_CONSOLE_PASSWORD Authentication Service:
https://region-a.geo-1.identity.hpcloudsvc.com:35357/auth/v1.0/
Page 123
TheREALChrisAnderson.com
Chris Anderson
12/17/12
5. Click "Test Connection" to verify your account settings are correct. Once that is complete, click OK. 6. You can modify which container you view, add files and download files.
Page 124
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 125
TheREALChrisAnderson.com
Chris Anderson
12/17/12
For further functions that Cloudberry can be used for, click here
Page 126
TheREALChrisAnderson.com
Chris Anderson
12/17/12
CloudBerry GUI Functions Cloudberry allows full use of the HP Cloud Storage service, similar to the GUI found on https://manage.hpcloud.com. For installation instructions, click here. 1.) Create a container: Click on the blue icon on the action bar.
Page 127
TheREALChrisAnderson.com
Chris Anderson
12/17/12
3.) Copy between containers: Change the source menu to the same account.
Page 128
TheREALChrisAnderson.com
Chris Anderson
12/17/12
4.) Drag and drop between containers (or alternately use the action bar for copy & move functions)
Page 129
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 130
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 131
TheREALChrisAnderson.com
Chris Anderson
12/17/12
5.) Copy from local host to containers: Similar to coping between containers, change the source to the local host, i.e. My Computer. Then choose the location on the computer to where your desired files are located.
Page 132
TheREALChrisAnderson.com
Chris Anderson
12/17/12
6.) Create a folder: While in a container (under your HP Cloud Storage) click on the folder icon on the action bar.
Page 133
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 134
TheREALChrisAnderson.com
Chris Anderson
12/17/12
8.) Move files into the folder by dragging and dropping or changing the source.
Page 135
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 136
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Page 137
TheREALChrisAnderson.com
Chris Anderson
12/17/12
Gladinet GUI
https://community.hpcloud.com/article/gladinet-gui By Jessica Ambriz, 5 months 2 weeks ago
Gladinet is a third party application for Windows XP, Vista, and 7 which allows your Object Storage container to be mounted as a local drive within Windows Explorer. The following steps detail downloading and setting up the application with HP Cloud Services container. 1) Install the appropriate version based on your operating system: 32bit or 64-bit
2) Choose to Launch Gladinet Cloud Desktop when closing the installer window.
Page 138
TheREALChrisAnderson.com
Chris Anderson
12/17/12
3) Open the Gladinet Management Console and click Attach Cloud Storage.
Page 139
TheREALChrisAnderson.com
Chris Anderson
12/17/12
4) Choose OpenStack Storage as your Storage Service and choose a name for the directory.
Page 140
TheREALChrisAnderson.com
Chris Anderson
12/17/12
5) Enter your username as TENANT_ID:emailaddress@frommanageconsole.com, your password is the password you use to login to the manage console. Enter the name of the container youd like to access or a new name if creating a container. Then, enter the Access Point from your API Keys page with the version being v1.0 instead of v2.0.
Page 141
TheREALChrisAnderson.com
Chris Anderson
12/17/12
6) Click Next and open Windows Explorer. You should now be able to view the contents of your container. Enjoy! Please Note: If you have multiple containers, youll need to mount each individually using the same steps above.
Page 142