Gerald Sim <gerald@meappy.com>
-
SSH
[user@local-host ~] ssh -i user_key.pem -p 2233 user@jump-host.hosted.meappy.com
-
Source Keystone Identity file
bin bash[user@jump-host ~]$ source keystonerc_user
[user@jump-host ~(keystone_user)]$
-
List Nova instances in project
[user@jump-host ~(keystone_user)]$ nova list
+--------------------------------------+--------------+---------+------------+-------------+-----------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+--------------+---------+------------+-------------+-----------------------------+
| 37d8cdf4-4079-4b23-acc6-8518c9b771eb | centos2 | SHUTOFF | - | Shutdown | int=192.168.1.4 |
| 9cdec55e-a3c8-4c38-bdcb-7594eb3db3be | centos6 | ACTIVE | - | Running | int=192.168.1.10, 10.1.1.67 |
| 20736923-b1b4-4a49-898c-63fdc007d4d6 | centos6-2 | ACTIVE | - | Running | int=192.168.1.11, 10.1.1.65 |
| 2f5e5fca-4128-4a74-b6ec-d103b2b9e932 | instance5 | ACTIVE | - | Running | int=192.168.1.9 |
+--------------------------------------+--------------+---------+------------+-------------+-----------------------------+
-
List available images
[user@jump-host ~(keystone_user)]$ glance image-list
+--------------------------------------+------------------------------------------+-------------+------------------+------------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+------------------------------------------+-------------+------------------+------------+--------+
| d618db8e-abd8-452c-8802-5b03a7425cf5 | CentOS-6-x86_64-GenericCloud-20141129_01 | qcow2 | bare | 1151533056 | active |
| 6cb73530-a737-4a22-853b-73a9f77a74e0 | CentOS-7-x86_64-GenericCloud-1503 | qcow2 | bare | 1004994560 | active |
| d6149b97-a006-46e5-9d2e-651fbbae0251 | CentOS-Atomic-Host-7-GenericCloud | qcow2 | bare | 916848640 | active |
| 0c39fed9-2472-49c8-bda0-7af9673ec576 | centos6-snapshot | qcow2 | bare | 1275789312 | active |
| 60aa11ac-1841-4528-9295-6e244e3e3489 | CoreOS | qcow2 | bare | 493813760 | active |
+--------------------------------------+------------------------------------------+-------------+------------------+------------+--------+
-
List keypairs
[user@jump-host ~(keystone_user)]$ nova keypair-list
+----------+-------------------------------------------------+
| Name | Fingerprint |
+----------+-------------------------------------------------+
| user_key | a8:89:4b:e6:15:1f:77:33:61:03:9d:fd:e4:a9:c4:9c |
+----------+-------------------------------------------------+
-
List security groups
[user@jump-host ~(keystone_user)]$ nova secgroup-list
+--------------------------------------+-----------+------------------------+
| Id | Name | Description |
+--------------------------------------+-----------+------------------------+
| 50973d6c-e2dd-496d-9811-57522f70311c | Web + SSH | Web + SSH |
| 2ed9ba36-42da-4dae-b073-d5caf323721d | default | Default security group |
+--------------------------------------+-----------+------------------------+
-
Launch instance
[user@jump-host ~(keystone_user)]$ nova boot --flavor m1-plus.tiny --key_name user_key --image d6149b97-a006-46e5-9d2e-651fbbae0251 --security-groups 'Web + SSH' instance1
-
Create floating IP
[user@jump-host ~(keystone_user)]$ nova floating-ip-create ext
+--------------------------------------+-----------+-----------+----------+------+
| Id | IP | Server Id | Fixed IP | Pool |
+--------------------------------------+-----------+-----------+----------+------+
| c4d13b92-8be9-455a-ba6a-eca5f804fe3c | 10.1.1.70 | - | - | ext |
+--------------------------------------+-----------+-----------+----------+------+
-
Attach floating IP to newly created instance
[user@jump-host ~(keystone_user)]$ nova floating-ip-associate instance1 10.1.1.70
-
SSH into instance from jump-host with private key file
[user@jump-host ~(keystone_user)]$ ssh -i .ssh/user_key.pem centos@10.1.1.70
The authenticity of host '10.1.1.70 (10.1.1.70)' can't be established.
ECDSA key fingerprint is 41:4a:f1:21:cb:e5:a6:62:92:f9:ea:6d:a6:7f:37:49.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.1.1.70' (ECDSA) to the list of known hosts.
[centos@instance1 ~]$
-
SSH directly into instance from local machine, via jump-host
[user@local-host ~] ssh -i user_key1.pem -tt -p 2233 user@jump-host.hosted.meappy.com ssh -i .ssh/user_key1.pem -tt centos@10.1.1.70
[centos@instance1 ~]$
- If you get a message like this
# nova boot --flavor m1-plus.tiny --key_name key1 --image d618db8e-abd8-452c-8802-5b03a7425cf5 test-centos6
ERROR (BadRequest): Multiple possible networks found, use a Network ID to be more specific. (HTTP 400) (Request-ID: req-b374145d-1cfd-458a-941e-bd0af74ab8f8)
# neutron net-list
+--------------------------------------+------+-----------------------------------------------------+
| id | name | subnets |
+--------------------------------------+------+-----------------------------------------------------+
| bc0163a3-411c-4a4c-a483-c10d0fede952 | ext | 07ba8cb8-54b4-41b4-8722-72280244f95f 10.1.1.0/24 |
| c69600e7-a55d-4274-b87b-6d05a29794f3 | int | 347d6eb8-7ee3-4ec9-aec0-38f82d1a7474 192.168.0.0/24 |
+--------------------------------------+------+-----------------------------------------------------+
# nova boot --poll --flavor m1-plus.tiny --key_name key1 --image d618db8e-abd8-452c-8802-5b03a7425cf5 --nic net-id=c69600e7-a55d-4274-b87b-6d05a29794f3 test-centos6