Getting started with the OpenStack API
Objective
In order to automate your operations on the Public Cloud, it is possible to use OpenStack APIs to generate different scripts.
The Nova client was previously used to manage your instances and their disks. It is now deprecated and the commands have been merged into the Python OpenStack client.
For example, you can start creating an additional instance when your monitoring tools detect a peak load in order to avoid saturation on your infrastructure. It is also possible to schedule snapshot creation on a regular basis at the same time.
This guide will help you take the OpenStack APIs into your hands to manage your instances using the Python OpenStack client.
Requirements
Please refer to the following guides:
Instructions
You can obtain the list of possible commands by reading the embedded documentation:
You can filter the commands displayed by indicating the group.
It is also possible to get information about a command by adding "help" in front of it:
You can obtain the Python Client documentation from the OpenStack Website.
Basic Operations
Adding an SSH Public Key
As a first step, it is necessary to add a Public SSH key to connect to the instances.
- List commands associated with SSH keys
- Add a Public SSH key
- List available SSH Keys:
Listing the instance models
Next, you will need to obtain the ID of the model that you would like to use:
Listing available images
Finally, you need to obtain the ID of the image you want to use on the instance:
Creating an instance
With the information that has been previously obtained, it is now possible to create an instance:
After a few moments, you can verify the list of instances to find the newly created instance:
Deleting an instance
You can delete an instance with the following command:
Go further
Join our community of users.