Monday 9 June 2014

Steps to launch a new instance in OpenStack and ssh into it using a floating IP




[Steps summarised from http://docs.openstack.org/user-guide/content/launch_from_image.html]



Pre-requisites

Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-setup-openstack-command-line.html to setup command line tools for OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-new-tenant-and-users-on.html to create a tenant and user for OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-initial-networks-for.html to create public network, private network, and a router.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-add-image-to-openstack.html to add a new qcow2 image to OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-keypair-in-openstack.html to create a new keypair in OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-and-update-security.html to create a new security group in OpenStack.
Run steps from link http://itinsteps.blogspot.in/2014/06/steps-to-create-new-flavor-in-openstack.html to create a new flavor in OpenStack.



Set environment for your specific user and tenant

# source ~/keystonerc_<user-name>



Gather required parameters

# nova flavor-list
Note the <flavor-ID> from the ID column displayed.

# nova image-list
Note the <image-ID> from the ID column displayed.

# nova keypair-list
Note the <key-name> from the Name column displayed.

# nova secgroup-list
Note the <secgroup> from the Name column displayed.

# nova net-list
Note the <tenant-network-ID> from the ID column for the tenant network (not the external network).

# nova floating-ip-list
Note the <floating-IP> from the Ip column, with "-" in the Fixed IP column, to get an unassociated floating IP.



Create a new instance using parameters set above

# nova boot --flavor <flavor-ID> \
                  --image <image-ID> \
                  --key-name <key-name> \
                  --security-groups <secgroup> \
                  --nic <net-id=net-uuid> \
                  <instance-name>



Assign a floating IP to the instance created

# nova floating-ip-associate <instance-name> <floating-IP>



SSH into the new instance using the floating IP and the private key file for <key-name>

# ssh -i <my-key>.pem <user-name>@<floating-IP>

NOTE:
Full path for <my-key>.pem should be mentioned.
1. Username for the instances will depend on the type of the image.
2. Following are a few examples:
CentOS 6.5 (http://repos.fedorapeople.org/repos/openstack/guest-images/centos-6.5-20140117.0.x86_64.qcow2): cloud-user
Fedora 19 (http://cloud.fedoraproject.org/fedora-19.x86_64.qcow2): fedora
Ubuntu 12.04 (http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img): ubuntu



No comments:

Post a Comment