8.4. Launching a Compute Instance
When launching a Compute instance using OpenStack, you must specify the ID for the flavor you want to use for the instance. A flavor is a resource allocation profile. For example, it specifies how many virtual CPUs and how much RAM your instance will get. To see a list of the available profiles, run the
nova flavor-list command.
$nova flavor-list+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True | | 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True | | 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True | | 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True | | 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
Get the ID of the image you would like to use for the instance using the
nova image-list command. Create the instance using nova boot. If there is not enough RAM available to start an instance, Compute will not do so. Create an instance using flavor 1 or 2. Once the instance has been created, it will show up in the output of nova list. You can also retrieve additional details about the specific instance using the nova show command.
$nova image-list+--------------------------------------+-----------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+-----------+--------+--------+ | 17a34b8e-c573-48d6-920c-b4b450172b41 | RHEL 6.2 | ACTIVE | | +--------------------------------------+-----------+--------+--------+$nova boot --flavor 2 --key_name oskey --image 17a34b8e-c573-48d6-920c-b4b450172b41 rhel+------------------------+--------------------------------------+ | Property | Value | +------------------------+--------------------------------------+ | OS-DCF:diskConfig | MANUAL | | OS-EXT-STS:power_state | 0 | | OS-EXT-STS:task_state | scheduling | | OS-EXT-STS:vm_state | building | | accessIPv4 | | | accessIPv6 | | | adminPass | QVAmyS5i5etE | | config_drive | | | created | 2012-05-18T13:41:40Z | | flavor | m1.small | | hostId | | | id | 0e4011a4-3128-4674-ab16-dd1b7ecc126e | | image | RHEL 6.2 | | key_name | oskey | | metadata | {} | | name | rhel | | progress | 0 | | status | BUILD | | tenant_id | 05816b0106994f95a83b913d4ff995eb | | updated | 2012-05-18T13:41:40Z | | user_id | 1d59c0bfef9b4ea9ab63e2a058e68ae0 | +------------------------+--------------------------------------+$nova list+--------------------------------------+--------+--------+------------------+ | ID | Name | Status | Networks | +--------------------------------------+--------+--------+------------------+ | 0e4011a4-3128-4674-ab16-dd1b7ecc126e | rhel | BUILD | demonet=10.0.0.2 | +--------------------------------------+--------+--------+------------------+$nova list+--------------------------------------+--------+--------+------------------+ | ID | Name | Status | Networks | +--------------------------------------+--------+--------+------------------+ | 0e4011a4-3128-4674-ab16-dd1b7ecc126e | rhel | ACTIVE | demonet=10.0.0.2 | +--------------------------------------+--------+--------+------------------+$nova show 0e4011a4-3128-4674-ab16-dd1b7ecc126e
Once enough time has passed so that the instance is fully booted and initialized, you can ssh into the instance. You can obtain the IP address of the instance from the output of
nova list.
$ssh -i oskey.priv root@10.0.0.2