Public API is now available ! How to configure the Openstack CLI

Hello,
We just released the public API for GandiCloud Platform.:champagne::champagne::champagne: :grinning:

You can now create / manage thanks to the Openstack CLI. This post details how to configure your Openstack CLI.

GandiCloud VPS beta - How to configure the CLI ?

# Get started : Prepare your environment to use the Openstack CLI

1. install the python openstack client :


pip3 install openstackclient

2. Create a configuration file for the Openstack CLI. name โ€œmy_gostack_conf.shโ€

And enter the following lines:

#!/usr/bin/env bash

export OS_USERNAME="<your gandiv5 username>"
export OS_PROJECT_NAME="<The name of the Gandi registered organization you wish to manage resources for>"
export OS_USER_DOMAIN_NAME=public
export OS_PROJECT_DOMAIN_NAME=public
export OS_AUTH_URL=https://keystone.sd6.api.gandi.net:5000/v3
export OS_IDENTITY_API_VERSION=3
echo "Please enter your GOStack Password for project $OS_PROJECT_NAME as user $OS_USERNAME: (same password as your gandi v5 account)"
read -sr OS_PASSWORD_INPUT
export OS_PASSWORD="$OS_PASSWORD_INPUT"

Then source it in your current shell (and on every other shell you wish to use openstack CLI):


$ source my_gostack_conf.sh

It will prompt for your password. Please note: your password will be stored in the OS_PASSWORD environment variable.


3. Your environment is ready, you shoud be able now to use the Gandi openstack CLI to create your first server

# Create your first openstack server


# Select an image for your server: image are preinstalled OS that your VM will boot with
$ openstack image list

# Select a flavor for your server, flavor is a couple of CPU&RAM you wish for your VM
$ openstack flavor list

# Create a keypair: keypair are SSH keys, you may only provide your public key, this public key will be installed on your VM allowing you to SSH on it
$ openstack keypair create --public-key <your_public_key_file> <keypair_name>

# Create your server (Note: this command will actually create a new volume and attach it to your new server)
$ openstack server create --flavor <flavor_id_or_name> --image <image_id_or_name> --boot-from-volume <size-in-GB> --network public --key-name <keypair_name> <server_hostname>

# Your server will be in status "BUILD" directly after creation, then it should switch to "ACTIVE".
# You can monitor its status using:
$ openstack server list

:champagne: Congratulations, you just created your first openstack server ! :champagne:

You can ssh into it using your private key, or get the console URL to open in your browser using (donโ€™t forget to set a password before connecting to the console):


openstack console url show <your_server_name_or_id>

Want to do more ?

You can find the official CLI user documentation here:

https://docs.openstack.org/python-openstackclient/ussuri/

For other tools or API direct access, keystone endpoint is available at:

https://keystone.sd6.api.gandi.net:5000/v3

Project are mapped to organization and your user is identical to Gandi V5.

3 Likes