OpenStack Flamingo : Create Instances2025/11/18 |
|
Create and Start Virtual Machine Instances. |
|
| [1] | Login as a user that you set environment variables for Openstack and then create and start virtual machine instance. |
|
# confirm available [flavor] list ubuntu@dlp ~(keystone)$ openstack flavor list +----+-----------+-------+------+-----------+-------+-----------+ | ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public | +----+-----------+-------+------+-----------+-------+-----------+ | 1 | m1.tiny | 2048 | 10 | 0 | 1 | True | | 2 | m1.small | 4096 | 10 | 0 | 2 | True | | 3 | m1.medium | 8192 | 10 | 0 | 4 | True | | 4 | m1.large | 16384 | 10 | 0 | 8 | True | | 5 | m2.medium | 8192 | 10 | 10 | 4 | True | +----+-----------+-------+------+-----------+-------+-----------+ # confirm available image list ubuntu@dlp ~(keystone)$ openstack image list +--------------------------------------+------------+--------+ | ID | Name | Status | +--------------------------------------+------------+--------+ | c8be4fc8-a3f7-4859-9ae7-8b3843baa619 | Ubuntu2404 | active | +--------------------------------------+------------+--------+ # confirm available network list ubuntu@dlp ~(keystone)$ openstack network list +--------------------------------+------------+--------------------------------+ | ID | Name | Subnets | +--------------------------------+------------+--------------------------------+ | 1a0fa146-6b84-4570-8c02- | sharednet1 | 80702b4b-1830-4c5b-bc9b- | | 30b980c402e8 | | 77378f4b16ef | +--------------------------------+------------+--------------------------------+ # create a security group for instances ubuntu@dlp ~(keystone)$ openstack security group create secgroup01 +-----------------+------------------------------------------------------------+ | Field | Value | +-----------------+------------------------------------------------------------+ | created_at | 2025-11-18T01:37:09Z | | description | secgroup01 | | id | fa4b5619-af27-46a2-97f2-43b67bc91070 | | is_shared | False | | name | secgroup01 | | project_id | b45ce8ac12c749e49e933c84334e79de | | revision_number | 1 | | rules | created_at='2025-11-18T01:37:09Z', direction='egress', | | | ethertype='IPv4', | | | id='176679c5-a359-4c7f-8457-c973704497de', | | | standard_attr_id='21', updated_at='2025-11-18T01:37:09Z' | | | created_at='2025-11-18T01:37:09Z', direction='egress', | | | ethertype='IPv6', | | | id='ace03be1-cc08-43c8-9787-49056335d2d7', | | | standard_attr_id='22', updated_at='2025-11-18T01:37:09Z' | | stateful | True | | tags | [] | | updated_at | 2025-11-18T01:37:09Z | +-----------------+------------------------------------------------------------+ubuntu@dlp ~(keystone)$ openstack security group list +---------------+------------+---------------+-----------------+------+--------+ | ID | Name | Description | Project | Tags | Shared | +---------------+------------+---------------+-----------------+------+--------+ | 9a3074bf- | default | Default | b45ce8ac12c749e | [] | False | | 6ba2-4185- | | security | 49e933c84334e79 | | | | 9b16- | | group | de | | | | fccf852218a0 | | | | | | | fa4b5619- | secgroup01 | secgroup01 | b45ce8ac12c749e | [] | False | | af27-46a2- | | | 49e933c84334e79 | | | | 97f2- | | | de | | | | 43b67bc91070 | | | | | | +---------------+------------+---------------+-----------------+------+--------+ # create an SSH keypair for connecting to instances ubuntu@dlp ~(keystone)$ ssh-keygen -q -N "" Enter file in which to save the key (/home/ubuntu/.ssh/id_ed25519): # add public-key ubuntu@dlp ~(keystone)$ openstack keypair create --public-key ~/.ssh/id_ed25519.pub mykey +-------------+-------------------------------------------------+ | Field | Value | +-------------+-------------------------------------------------+ | created_at | None | | fingerprint | 32:90:22:ae:18:6e:a6:a4:20:30:18:d0:a4:70:76:66 | | id | mykey | | is_deleted | None | | name | mykey | | type | ssh | | user_id | 8fb39b6516284abe94f287d259b160b6 | +-------------+-------------------------------------------------+ubuntu@dlp ~(keystone)$ openstack keypair list +-------+-------------------------------------------------+------+ | Name | Fingerprint | Type | +-------+-------------------------------------------------+------+ | mykey | 32:90:22:ae:18:6e:a6:a4:20:30:18:d0:a4:70:76:66 | ssh | +-------+-------------------------------------------------+------+
ubuntu@dlp ~(keystone)$
netID=$(openstack network list | grep sharednet1 | awk '{ print $2 }') # create and start instance ubuntu@dlp ~(keystone)$ openstack server create --flavor m1.small --image Ubuntu2404 --security-group secgroup01 --nic net-id=$netID --key-name mykey Ubuntu-2404
+-------------------------------------+----------------------------------------+ | Field | Value | +-------------------------------------+----------------------------------------+ | OS-DCF:diskConfig | MANUAL | | OS-EXT-AZ:availability_zone | None | | OS-EXT-SRV-ATTR:host | None | | OS-EXT-SRV-ATTR:hostname | ubuntu-2404 | | OS-EXT-SRV-ATTR:hypervisor_hostname | None | | OS-EXT-SRV-ATTR:instance_name | None | | OS-EXT-SRV-ATTR:kernel_id | None | | OS-EXT-SRV-ATTR:launch_index | None | | OS-EXT-SRV-ATTR:ramdisk_id | None | | OS-EXT-SRV-ATTR:reservation_id | None | | OS-EXT-SRV-ATTR:root_device_name | None | | OS-EXT-SRV-ATTR:user_data | None | | OS-EXT-STS:power_state | N/A | | OS-EXT-STS:task_state | scheduling | | OS-EXT-STS:vm_state | building | | OS-SRV-USG:launched_at | None | | OS-SRV-USG:terminated_at | None | | accessIPv4 | None | | accessIPv6 | None | | addresses | N/A | | adminPass | VXnzfLRGySb5 | | config_drive | None | | created | 2025-11-18T03:25:08Z | | description | None | | flavor | description=, disk='10', | | | ephemeral='0', , id='m1.small', | | | is_disabled=, is_public='True', | | | location=, name='m1.small', | | | original_name='m1.small', ram='4096', | | | rxtx_factor=, swap='0', vcpus='2' | | hostId | None | | host_status | None | | id | 66db9dc2-0001-4e71-807d-1b55d353a90c | | image | Ubuntu2404 | | | (c8be4fc8-a3f7-4859-9ae7-8b3843baa619) | | key_name | mykey | | locked | None | | locked_reason | None | | name | Ubuntu-2404 | | pinned_availability_zone | None | | progress | None | | project_id | b45ce8ac12c749e49e933c84334e79de | | properties | None | | scheduler_hints | | | security_groups | name='fa4b5619-af27-46a2-97f2- | | | 43b67bc91070' | | server_groups | None | | status | BUILD | | tags | | | trusted_image_certificates | None | | updated | 2025-11-18T03:25:08Z | | user_id | 8fb39b6516284abe94f287d259b160b6 | | volumes_attached | | +-------------------------------------+----------------------------------------+ # verify status (it shows [BUILD] for a while) ubuntu@dlp ~(keystone)$ openstack server list +----------------+-------------+--------+----------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +----------------+-------------+--------+----------+------------+----------+ | 66db9dc2-0001- | Ubuntu-2404 | BUILD | | Ubuntu2404 | m1.small | | 4e71-807d- | | | | | | | 1b55d353a90c | | | | | | +----------------+-------------+--------+----------+------------+----------+ # when starting normally, the status turns to [ACTIVE] ubuntu@dlp ~(keystone)$ openstack server list +--------------+-------------+--------+---------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------+-------------+--------+---------------+------------+----------+ | 66db9dc2- | Ubuntu-2404 | ACTIVE | sharednet1=10 | Ubuntu2404 | m1.small | | 0001-4e71- | | | .0.0.233 | | | | 807d- | | | | | | | 1b55d353a90c | | | | | | +--------------+-------------+--------+---------------+------------+----------+ |
| [2] | Configure security settings for the security group you created above to access with SSH and ICMP. |
|
# permit ICMP ubuntu@dlp ~(keystone)$ openstack security group rule create --protocol icmp --ingress secgroup01 +-------------------------+--------------------------------------+ | Field | Value | +-------------------------+--------------------------------------+ | belongs_to_default_sg | False | | created_at | 2025-11-18T01:40:43Z | | description | | | direction | ingress | | ether_type | IPv4 | | id | 667509a4-3721-4d5c-b4bc-1512e8fe1f81 | | normalized_cidr | 0.0.0.0/0 | | port_range_max | None | | port_range_min | None | | project_id | b45ce8ac12c749e49e933c84334e79de | | protocol | icmp | | remote_address_group_id | None | | remote_group_id | None | | remote_ip_prefix | 0.0.0.0/0 | | revision_number | 0 | | security_group_id | fa4b5619-af27-46a2-97f2-43b67bc91070 | | updated_at | 2025-11-18T01:40:43Z | +-------------------------+--------------------------------------+ # permit SSH ubuntu@dlp ~(keystone)$ openstack security group rule create --protocol tcp --dst-port 22:22 secgroup01 +-------------------------+--------------------------------------+ | Field | Value | +-------------------------+--------------------------------------+ | belongs_to_default_sg | False | | created_at | 2025-11-18T01:40:59Z | | description | | | direction | ingress | | ether_type | IPv4 | | id | 0e2ed1b1-543a-456a-b0dd-01483ad55721 | | normalized_cidr | 0.0.0.0/0 | | port_range_max | 22 | | port_range_min | 22 | | project_id | b45ce8ac12c749e49e933c84334e79de | | protocol | tcp | | remote_address_group_id | None | | remote_group_id | None | | remote_ip_prefix | 0.0.0.0/0 | | revision_number | 0 | | security_group_id | fa4b5619-af27-46a2-97f2-43b67bc91070 | | updated_at | 2025-11-18T01:40:59Z | +-------------------------+--------------------------------------+ubuntu@dlp ~(keystone)$ openstack security group rule list secgroup01 +----------+-------------+-----------+----------+------------+-----------+-----------------------+----------------------+ | ID | IP Protocol | Ethertype | IP Range | Port Range | Direction | Remote Security Group | Remote Address Group | +----------+-------------+-----------+----------+------------+-----------+-----------------------+----------------------+ | 0e2ed1b1 | tcp | IPv4 | 0.0.0.0/ | 22:22 | ingress | None | None | | -543a- | | | 0 | | | | | | 456a- | | | | | | | | | b0dd- | | | | | | | | | 01483ad5 | | | | | | | | | 5721 | | | | | | | | | 176679c5 | None | IPv4 | 0.0.0.0/ | | egress | None | None | | -a359- | | | 0 | | | | | | 4c7f- | | | | | | | | | 8457- | | | | | | | | | c9737044 | | | | | | | | | 97de | | | | | | | | | 667509a4 | icmp | IPv4 | 0.0.0.0/ | | ingress | None | None | | -3721- | | | 0 | | | | | | 4d5c- | | | | | | | | | b4bc- | | | | | | | | | 1512e8fe | | | | | | | | | 1f81 | | | | | | | | | ace03be1 | None | IPv6 | ::/0 | | egress | None | None | | -cc08- | | | | | | | | | 43c8- | | | | | | | | | 9787- | | | | | | | | | 49056335 | | | | | | | | | d2d7 | | | | | | | | +----------+-------------+-----------+----------+------------+-----------+-----------------------+----------------------+ |
| [3] | Login to the instance with SSH. |
|
ubuntu@dlp ~(keystone)$ openstack server list +--------------+-------------+--------+---------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------+-------------+--------+---------------+------------+----------+ | 66db9dc2- | Ubuntu-2404 | ACTIVE | sharednet1=10 | Ubuntu2404 | m1.small | | 0001-4e71- | | | .0.0.233 | | | | 807d- | | | | | | | 1b55d353a90c | | | | | | +--------------+-------------+--------+---------------+------------+----------+ubuntu@dlp ~(keystone)$ ping 10.0.0.233 -c3 PING 10.0.0.233 (10.0.0.233) 56(84) bytes of data. 64 bytes from 10.0.0.233: icmp_seq=1 ttl=64 time=1.21 ms 64 bytes from 10.0.0.233: icmp_seq=2 ttl=64 time=0.775 ms 64 bytes from 10.0.0.233: icmp_seq=3 ttl=64 time=0.618 ms --- 10.0.0.233 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 0.618/0.867/1.209/0.249 msubuntu@dlp ~(keystone)$ ssh ubuntu@10.0.0.233
The authenticity of host '10.0.0.233 (10.0.0.233)' can't be established. ED25519 key fingerprint is SHA256:6VDEzpuOZnwMtMnHudfMHaWugX9Vf0LZM/3gZLyGRwI. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '10.0.0.233' (ED25519) to the list of known hosts. Welcome to Ubuntu 24.04.3 LTS (GNU/Linux 6.8.0-87-generic x86_64) ..... ..... To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. ubuntu@ubuntu-2404:~$ # logined |
| [4] | If you'd like to stop an instance, it's possible to control with openstack command like follows. |
|
ubuntu@dlp ~(keystone)$ openstack server list +--------------+-------------+--------+---------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------+-------------+--------+---------------+------------+----------+ | 66db9dc2- | Ubuntu-2404 | ACTIVE | sharednet1=10 | Ubuntu2404 | m1.small | | 0001-4e71- | | | .0.0.233 | | | | 807d- | | | | | | | 1b55d353a90c | | | | | | +--------------+-------------+--------+---------------+------------+----------+ # stop instance ubuntu@dlp ~(keystone)$ openstack server stop Ubuntu-2404 ubuntu@dlp ~(keystone)$ openstack server list +--------------+-------------+---------+---------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------+-------------+---------+---------------+------------+----------+ | 66db9dc2- | Ubuntu-2404 | SHUTOFF | sharednet1=10 | Ubuntu2404 | m1.small | | 0001-4e71- | | | .0.0.233 | | | | 807d- | | | | | | | 1b55d353a90c | | | | | | +--------------+-------------+---------+---------------+------------+----------+ # start instance ubuntu@dlp ~(keystone)$ openstack server start Ubuntu-2404 ubuntu@dlp ~(keystone)$ openstack server list +--------------+-------------+--------+---------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------+-------------+--------+---------------+------------+----------+ | 66db9dc2- | Ubuntu-2404 | ACTIVE | sharednet1=10 | Ubuntu2404 | m1.small | | 0001-4e71- | | | .0.0.233 | | | | 807d- | | | | | | | 1b55d353a90c | | | | | | +--------------+-------------+--------+---------------+------------+----------+ |
| [5] | It's possible to access with Web browser to get VNC console. |
|
ubuntu@dlp ~(keystone)$ openstack server list +--------------+-------------+--------+---------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------+-------------+--------+---------------+------------+----------+ | 66db9dc2- | Ubuntu-2404 | ACTIVE | sharednet1=10 | Ubuntu2404 | m1.small | | 0001-4e71- | | | .0.0.233 | | | | 807d- | | | | | | | 1b55d353a90c | | | | | | +--------------+-------------+--------+---------------+------------+----------+ubuntu@dlp ~(keystone)$ openstack console url show Ubuntu-2404 +----------+-------------------------------------------------------------------+ | Field | Value | +----------+-------------------------------------------------------------------+ | protocol | vnc | | type | novnc | | url | https://dlp.srv.world:6080/vnc_auto.html?path=%3Ftoken%3D75c557c2 | | | -29b2-412b-bf1e-b64a9305aa24 | +----------+-------------------------------------------------------------------+ |
| [6] | Access to the URL which was displayed by the command above. |
|
| Sponsored Link |
|
|