{"id":19766,"date":"2023-09-14T20:21:12","date_gmt":"2023-09-14T19:21:12","guid":{"rendered":"https:\/\/www.oderland.se\/support\/artikel\/how-do-i-use-openstackclient-to-manage-oderland-cloud\/"},"modified":"2023-09-14T20:21:13","modified_gmt":"2023-09-14T19:21:13","slug":"how-do-i-use-openstackclient-to-manage-oderland-cloud","status":"publish","type":"ht_kb","link":"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-use-openstackclient-to-manage-oderland-cloud\/","title":{"rendered":"How do I use OpenStackClient to manage Oderland Cloud?"},"content":{"rendered":"\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">This guide is intended for advanced users.<\/p>\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/www.oderland.se\/cloud\/\" data-type=\"URL\" data-id=\"https:\/\/www.oderland.com\/cloud\/\" target=\"_blank\">Oderland Cloud<\/a> is based on OpenStack and in addition to our control panel, you can also manage and administer your environment efficiently with the OpenStackClient. The client allows for management through the terminal or command prompt, providing easy access to a wide range of features for both daily use and automation of various processes.<\/p>\n\n<p>This is a general guide showing how to connect to your OpenStack environment through the OpenStackClient. It also covers the use of YAML files for configuration, providing a convenient and flexible method of authentication. With these steps, you can quickly start interacting with your OpenStack environment and manage your cloud resources smoothly.<\/p>\n\n<h2 class=\"wp-block-heading\">Preparations<\/h2>\n\n<p>Now let&#8217;s explore the steps required to configure and use OpenStackClient to connect to your OpenStack environment.<\/p>\n\n<ol class=\"wp-block-list\">\n<li><strong>Install OpenStackClient:<\/strong><br\/>First, you need to install the client on your local computer. Depending on your operating system, the installation process may vary slightly. For example, you can use pip (package manager for Python) to install OpenStackClient by running the following command in the terminal:<\/li>\n<\/ol>\n\n<pre class=\"wp-block-preformatted\">pip install python-openstackclient<\/pre>\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li><strong>Create a configuration file:<\/strong><br\/>Create a YAML file (name it clouds.yaml) that contains your credentials and other necessary settings to connect to your OpenStack environment. You can place the file in your current folder right now, but check the official documentation for more information on where the file can be saved for different operating systems. Here is an example of what the file might look like (replace project-name, user-name and password with your details):<\/li>\n<\/ol>\n\n<pre class=\"wp-block-preformatted\">clouds:&#13;\n  oderland:&#13;\n    auth:&#13;\n      auth_url: https:\/\/cloud-api.oderland.com:5000&#13;\n      project_name: <code>project-name<\/code>&#13;\n      username: <code>user-name<\/code>&#13;\n      password: <code>password<\/code>&#13;\n      user_domain_name: cloud&#13;\n      project_domain_name: cloud<\/pre>\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">You can find your <code>project-name<\/code> inside the Oderland Cloud <a rel=\"noreferrer noopener\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-login-to-the-control-panel-for-oderland-cloud\/\" data-type=\"ht_kb\" data-id=\"18245\" target=\"_blank\">control panel<\/a>, in the top right corner when you are logged in.<br><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2023\/08\/oderland_cloud_project_id.png\"><img loading=\"lazy\" decoding=\"async\" width=\"256\" height=\"73\" class=\"wp-image-19508\" style=\"width: 256px;\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2023\/08\/oderland_cloud_project_id.png\" alt=\"\" srcset=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2023\/08\/oderland_cloud_project_id.png 256w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2023\/08\/oderland_cloud_project_id-50x14.png 50w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2023\/08\/oderland_cloud_project_id-60x17.png 60w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2023\/08\/oderland_cloud_project_id-100x29.png 100w\" sizes=\"auto, (max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\r\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li><strong>Test connection with <code>openstack<\/code>:<\/strong><br\/>Now use the <code>--os-cloud<\/code>-flag to specify which profile to use with your <code>openstack<\/code> commands. For example, you can use the following CLI command (remember to replace <code>oderland<\/code> if you called the profile for something else in step 2):<\/li>\n<\/ol>\n\n<pre class=\"wp-block-preformatted\">openstack --os-cloud oderland server list<\/pre>\n\n<h2 class=\"wp-block-heading\">Exploring commands<\/h2>\n\n<p>Now that you have successfully connected to your environment, you can start using <code>openstack<\/code> to interact with different services. Explore the <code>openstack<\/code> documentation to learn about the different commands and how you can use them. Examples of some useful commands:<\/p>\n\n<ul class=\"wp-block-list\">\n<li><code>openstack --os-cloud oderland server list<\/code>: Lists all virtual machines in your project.<\/li>\n\n\n\n<li><code>openstack --os-cloud oderland image list<\/code>: Lists all the available images (operating systems that you can use for new virtual machines) in your environment.<\/li>\n\n\n\n<li><code>openstack --os-cloud oderland flavor list<\/code>: Lists all flavours that can be used to create virtual machines.<\/li>\n\n\n\n<li><code>openstack --os-cloud oderland network list<\/code>: Lists all networks in your environment.<\/li>\n\n\n\n<li><code>openstack --os-cloud oderland keypair create --public-key \/s\u00f6kv\u00e4g\/till\/publik_nyckel nyckel-namn<\/code>: Create a public key in Oderland Cloud that can be used when setting up servers. Enter the correct path and file name for the public key instead of <code>\/path\/to\/public_key<\/code> and enter the name you want the key to have in the control panel (instead of <code>key name<\/code>).<\/li>\n<\/ul>\n\n<p>Here is also an example of how to create a new virtual machine directly through the CLI (terminal\/command prompt):<\/p>\n\n<pre class=\"wp-block-preformatted\">openstack --os-cloud oderland server create \\&#13;\n    --wait \\&#13;\n    --format json \\&#13;\n    --flavor 'a1-c1-m1' \\&#13;\n    --image 'Debian 12' \\&#13;\n    --boot-from-volume 10 \\&#13;\n    --network 'public_1' \\&#13;\n    --key-name '<code>ssh-key-name<\/code>' \\&#13;\n    example-server<\/pre>\n\n<p>In the above example, a virtual machine called &#8220;example-server&#8221; will be created, with Debian 12 and a 10 GB volume. The server will be allocated on our network with the name `public_1`. You need to replace <code>ssh-key-name<\/code> with the name of <a rel=\"noreferrer noopener\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-manage-ssh-keys-in-oderland-cloud\/\" data-type=\"ht_kb\" data-id=\"18319\" target=\"_blank\">your uploaded SSH key<\/a>.<\/p>\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">There is much more information in the official documentation, see for example <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.openstack.org\/python-openstackclient\/latest\/\" target=\"_blank\">https:\/\/docs.openstack.org\/python-openstackclient\/latest\/<\/a>.<\/p>\r\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">It is also possible to use enviornment variables to specify credentials. More information on this can be found in the <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.openstack.org\/python-openstackclient\/latest\/cli\/man\/openstack.html#authentication-methods\" target=\"_blank\">openstack manual.<\/a>.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Oderland Cloud is based on OpenStack and in addition to our control panel, you can also manage and administer your environment efficiently with the OpenStackClient. The client allows for management through the terminal or command prompt, providing easy access to a wide range of features for both daily use and&#8230;<\/p>\n","protected":false},"author":12,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"ht-kb-category":[682],"ht-kb-tag":[],"class_list":["post-19766","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-cloud-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/19766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/comments?post=19766"}],"version-history":[{"count":1,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/19766\/revisions"}],"predecessor-version":[{"id":19767,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/19766\/revisions\/19767"}],"wp:attachment":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/media?parent=19766"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb-category?post=19766"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=19766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}