OpenStack cheat sheet

Youssef Idlahsen

Youssef IdlahsenFeb 10, 2023

7 min read1349 words

OpenStack OpenStack is a free, open-source software platform used for building and managing cloud computing infrastructure. It provides a set of interrelated services that control large pools of processing, storage, and networking resources. One of the key features of OpenStack is the ability to automate tasks through the use of command-line tools. In this article, we will take a comprehensive look at the various OpenStack commands that are available for managing and deploying cloud infrastructure. Whether you are a seasoned OpenStack user or just starting out, this article will provide you with a comprehensive list of OpenStack commands and their uses, making it a valuable resource for anyone working with OpenStack.

Install OpenStack yourself

Experiment with OpenStack on your personal computer, establish a small-scale cloud environment or implement a production-ready OpenStack cluster across numerous physical servers. You have the option to utilize MicroStack or OpenStack Charms, depending on your specific needs.

What’s covered:

  • Keystone
  • Glance
  • Neutron
  • Nova
  • Cinder

OpenStack Command Structure

OpenStackClient has a consistent and predictable format for all of its commands.

Commands take the form:

OpenStack command-line interface

openstack [<global-options>] <object-1> <action> [<object-2>] [<command-arguments>]

Users

Functions Commands
List users openstack user list
Show user details openstack user show <user ID>
Create user openstack user create --password <password> <user name>
Update user openstack user set <key> <value> <user ID>
Set user password openstack user password set
Delete user openstack user delete <user ID>

Groups

Functions Commands
List groups openstack group list
Show group details openstack group show <group ID>
Create group openstack group create <group name>
Update group openstack group set <key> <value> <group ID>
Add user to group openstack group add user <group ID> <user ID>
Remove user from openstack group remove user <group ID> <user ID>
Delete group openstack group delete <group ID>

Domains

Functions Commands
List domains openstack domain list
Show domain details openstack domain show <domain ID>
Create domain openstack domain create <domain name>
Update domain openstack domain set <key> <value> <domain ID>
Delete domain openstack domain delete <domain ID>

Projects

Functions Commands
List projects openstack project list
Show group details openstack project show <project ID>
Create project openstack project create <project name>
Update project openstack project set <key> <value> <project ID>
Delete project openstack project delete <project ID>

Roles

Functions Commands
Assign role on project openstack role add --project <project ID> [--user <user ID> | --group <group ID>] <role name>
Remove role on project openstack role remove --project <project ID> [--user <user ID> | --group <group ID>] <role name>

Images

Functions Commands
List images openstack image list
Show image details openstack image show <image ID>
Create image openstack image create --disk-format qcow2 --file <file path> <image name>
Update image openstack image set <key> <value> <image ID>
Delete image openstack image delete <image ID>

Flavors

Functions Commands
List flavors openstack flavor list
Show flavor details openstack flavor show <flavor name>
Create flavor openstack flavor create --vcpus <vCPUs> --ram <RAM [MB]> --disk <Disk [GB]> <flavor name>
Update flavor openstack flavor set <key> <value> <flavor name>
Delete flavor openstack flavor delete <flavor name>

Networks

Functions Commands
List networks openstack network list
Show network details openstack network show <network ID>
Create network openstack network create <network name>
Update network openstack network set <key> <value> <network ID>
Delete network openstack network delete <network ID>

Subnets

Functions Commands
List subnets openstack subnet list
Show subnet details openstack subnet show <subnet ID>
Create subnet openstack subnet create --network <network ID> --subnet-range <subnet CIDR> <subnet name>
Update subnet openstack subnet set <key> <value> <subnet ID>
Delete subnet openstack subnet delete <subnet ID>

Routers

Functions Commands
List routers openstack router list
Show router details openstack router show <router ID>
Create route openstack router create <router name>
Update router openstack router set <key> <value> <router ID>
Attach subnet to router openstack router add subnet <router ID> <subnet ID>
Detach subnet from route openstack router remove subnet <router ID> <subnet ID>
Delete router openstack router delete <router ID>

Security groups

Functions Commands
List security groups openstack router list
Show security group details openstack security group show <security group ID>
Create security group openstack security group create <security group name>
Update security group openstack security group set <key> <value> <security group ID>
List rules in the security group openstack security group rule list <security group ID>
Add rule to the security group openstack security group rule create <key> <value> <security group ID>
Delete rule from the security group openstack security group rule delete <rule ID>
Delete security group openstack security group delete <security group ID>

Key pairs

Functions Commands
List key pairs openstack keypair list
Show key pair details openstack keypair show <key pair name>
Create kay pair openstack keypair create --private-key <file path> <key pair name>
Delete key pair openstack keypair delete <key pair name>

Instances

Functions Commands
List instances openstack server list
Show instance details openstack server show <instance ID>
Create instance openstack server create --flavor <flavor name> --image <image ID> --network <network ID> --key-name <key pair name> <instance name>
Update instance openstack server set <key> <value> <instance ID>
Delete instance openstack server delete <instance ID>

Floating IPs

Functions Commands
List floating IPs openstack floating ip list
Create floating IP openstack floating ip create <network ID>
Attach floating IP to instance openstack server add floating ip <instance ID> <floating IP ID>
Detach floating IP from instance openstack server remove floating ip <instance ID> <floating IP ID>
Delete floating IP openstack floating ip delete <floating IP ID>

Volumes

Functions Commands
List volumes openstack volume list
Show volume details openstack volume show <volume ID>
Create volume openstack volume create --size <size [GB]> <volume name>
Update volume openstack volume set <key> <value> <volume ID>
Attach the volume to the instance openstack server add volume <instance ID> <volume ID>
Detach the volume from the instance openstack server remove volume <instance ID> <volume ID>
Delete volume openstack volume delete <volume ID>

Quotas

Functions Commands
List default quotas penstack quota show --default
Update default quotas openstack quota set <key> <value> --class default
List project quotas openstack quota show <project ID>
Update project quotas openstack quota set <key> <value> <project ID>

Youssef's Newsletter

Trust me, I won't spam you.

Share on Social Media: