How to Configure API User using OpenStack SDK? Print

  • 1

The API Users tab in the Cloud Control Panel gives you access to the OpenStack API. The API can be used to perform a wide range of server management activities.

You'll need to create the user in order to proceed further. Kindly refer to this guideline on how to create an API user.

1. Login to the Cloud Panel and go to the API users section. Download the OpenRC file by clicking on the Get OpenRC file. This will download a file we'll be using for authorization.

2. Choose MY-CJ1 region and click Get File to download the OpenRC file.

3. Access your server terminal and upload the openrc file into the server. You'll see the file is available on the server.

4. Next, install the necessary dependencies and applications to proceed further. Run the command below to install.

#  yum -y install python3-pip

#  yum -y install epel-release.noarch

#  yum -y install python3-virtualenv 

#  python3 -m venv .venv

5. Activate the .venv by using the command below. After you have run the command, you will be redirected to the (.venv) environment

#  source .venv/bin/activate

6. Run the command below to install the pip package. Make sure to run it in the (.venv) environment.

#  pip install -U pip

7. Install the python-openstackclient  and openstacksdk using the below command.

#  pip install python-openstackclient

#  pip install openstacksdk==0.61.0

8. Run the command below to connect to the openrc file that we have uploaded in Step 3. Then, enter the password of the API user that has been set before. You can refer to this guideline for the section on setting the password.

#  source openrc

9. You can verify by running the command below. The command below is the list of projects assigned to your GB Cloud account. You can get more command lists on OpenStack's official documentation.

#  openstack project list

Was this answer helpful?

« Back