Guide: OpenStack CLI – Basic Usage: Difference between revisions

From bwCloud-OS
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
= Guide: OpenStack CLI – Basic Usage =


This guide provides a quick introduction to managing your bwCloud-OS project using the OpenStack CLI. It covers the most common operations for compute, storage, and networking.
This guide provides a quick introduction to managing your bwCloud-OS project using the OpenStack CLI. It covers the most common operations for compute, storage, and networking.
__TOC__





Revision as of 22:02, 24 April 2026

This guide provides a quick introduction to managing your bwCloud-OS project using the OpenStack CLI. It covers the most common operations for compute, storage, and networking.


General Information about Cloud, Project, and User

Before working with resources, you can inspect your current configuration and context:

openstack configuration show
openstack project list
openstack token issue
openstack region list


Compute (Instances, Images)

Create an instance:

openstack server create \
  --image ubuntu-24.04 \
  --flavor m1.small \
  --network myNet \
  --key-name myKey \
  myVM

List instances:

openstack server list

Show details of an instance:

openstack server show myVM

Delete an instance:

openstack server delete myVM

List available images:

openstack image list

Show image details:

openstack image show <IMAGE_ID>


Storage (Volumes)

Create a volume:

openstack volume create --size 10 myVolume

List volumes:

openstack volume list

Attach a volume to an instance:

openstack server add volume myVM myVolume

Detach a volume:

openstack server remove volume myVM myVolume

Delete a volume:

openstack volume delete myVolume


Networking

Create a network:

openstack network create myNet

Create a subnet:

openstack subnet create mySubnet \
  --network myNet \
  --subnet-range 192.168.1.0/24

Create a router:

openstack router create myRouter

Attach subnet to router:

openstack router add subnet myRouter mySubnet

Set external gateway:

openstack router set myRouter --external-gateway provider_net

List networks:

openstack network list


Floating IPs (Public Access)

Create a floating IP:

openstack floating ip create provider_net

List floating IPs:

openstack floating ip list

Associate floating IP with instance:

openstack server add floating ip myVM <FLOATING_IP>

Remove floating IP:

openstack server remove floating ip myVM <FLOATING_IP>


Security (Security Groups & Rules)

List security groups:

openstack security group list

Create a security group:

openstack security group create mySecGroup

Add SSH access (port 22):

openstack security group rule create \
  --proto tcp \
  --dst-port 22 \
  mySecGroup

Add HTTP access (port 80):

openstack security group rule create \
  --proto tcp \
  --dst-port 80 \
  mySecGroup

Assign security group to instance:

openstack server add security group myVM mySecGroup


Key Pairs (SSH Access)

Create a key pair:

openstack keypair create myKey > myKey.pem
chmod 600 myKey.pem

List key pairs:

openstack keypair list

Delete a key pair:

openstack keypair delete myKey