Getting Started with the FUJITSU K5 API on a Windows Workstation

Updated 01/09/2017

K5 is built using one of the most open, secure and scalable cloud platforms available in the market today –Openstack. Due to this it means every function you see displayed in the portal (and some you don’t) are all available to consume via a REST API. For more information on REST APIs take a look at

REST APIs require you to programmatically interact with them, meaning you need to write code or use a specific tool to enable you to send or receive information. The interaction with K5 REST APIs is performed using Linux command line/code, so requires a basic understanding and comfortable with using the Linux command line and understanding code syntax.

A tool such as Cygwin, can be used to provide a Linux command line environment on a MS Windows workstation. Cygwin (pronounced SIG-win) is a Unix-like environment and command-line interface for Microsoft Windows, providing native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment. (See the end of this blog for details of using MobaXterm as an alternative to Cygwin)

In order to submit the REST API commands from within the Cygwin environment, the Linux tool cURL is used. This is a command-line tool that lets you send HTTP requests and receive responses. For some practical examples using cURL visit

JQ is a lightweight and flexible command-line JSON processor, that can be used to slice, filter, map and transform structured data passed to it. Its use is recommend and included in K5 API examples across the guides to filter, structure and present the result of submitted API commands in JSON format.


Installing Cygwin including cURL & JQ

1. Download the latest 64-bit version of Cygwin for Windows from make and run ‘setup-x86_64.exe’ to begin the install.

2. On the ‘Cygwin Setup’ screen click ‘Next’

3. On ‘Choose Installation Type’ screen select ‘Install from Internet’ and click ‘Next’

4. On ‘Choose Installation Directory’ screen, accept the default ‘Root Directory’ and ‘All Users (RECOMMENDED)’ and click ‘Next’

5. On ‘Select Local Package Directory’, accept the default and click ‘Next’

6. On ‘Select Connection Type’ screen, select ‘Use Internet Explorer Proxy Settings’ and click ‘Next’

7. On ‘Choose Download Site(s)’ screen, select anyone of the sites, click ‘Add’ and then ‘Next’

8. On ‘Select Package’ screen, enter ‘curl’ into the ‘Search’ box. NOTE: Do not click hit the ‘Return’ key as this progress the install wizard to the next screen.

9. In the results, expand ‘Net’ then click on ‘Default’ till it changes to ‘Install’.11. Next, enter ‘gcc’ into the ‘Search’ box, click ‘Default’ next to ‘Devel’ to install all compiles (a GCC C compiler is required if you want to try just individual components)

10. Next, enter ‘jq’ into the ‘Search’ box, expand ‘text ‘ and change ‘Default’ to install

11. If you would also like to install the Openstack CLI tools later, then I would also recommend installing

  • wget – expand web and change ‘Default’ to ‘Install’
  • pip –  expand python | python2-pip and change ‘Skip’ to <versionnumber>
  • python2-devel – expand python and change ‘Skip’ to <versionnumber>

(OPTIONAL) Other Linux components that you may be familiar with or likely to use can also be searched for and added in the same way.


  • To install the editor VIM, enter ‘VIM’ into the ‘Search’ box, then in the results, expand ‘Editors’, click on ‘Default’ to change it to ‘Install’ and click ‘Next’.
  • To install Make, enter ‘make’ into the ‘Search’ box, in the results expand ‘Devel’, click on ‘Skip’ for the package ‘make: The GNU version of the “make” utility’, till it changes to a version number.

Once all packages are selected click ‘Next’.

12. For any “Resolving Dependencies” screens that may appear, click ‘Next’. The installation then begins and typically completes in around 10 to 15 minutes

13. Once installed, on the ‘Installation Status and Create Icons’ screen, accept defaults and click ‘Finish’ to complete the install

14. Cygwin can now be opened by double clicking on the ‘Cygwin64 Terminal’ desktop icon


To configure CURL to work in conjunction with a Proxy Server, perform the following:

1. Within Cygwin, using an editor of choice to create the file ‘.curlrc’ in the default ‘home’ folder, e.g. ‘vim .curlrc’
2. Edit this file to add the following information:

proxy-user=”<username>:<password>”    e.g. proxy-user=”smithd:Password!”

proxy=”{PROXY URL>:<PORT>”                    e.g. proxy=”″

E.g. Within VIM, press ‘i’ to enter ‘Edit Mode’ and then enter the following two lines, replacing and with your credentials (there is no need to enter a domain) :

Hit the ‘Esc’ key, then press the ‘Shift’ and “:” keys together. This should result in command line colon for VIM being displayed in the bottom left hand side of the screen, indicating ‘Edit Mode’ has been exited. Enter ‘wq’ to save and exit VIM


Configure K5 REST API  Working Environment

The final step is to build the API working environment. This is documented within the Fujitsu K5 IaaS User Guide. Alternatively, you may want to review the blog, in which a script can be downloaded to set up the environment for you. Just note the section towards the end of this other blog about configuring the script to either construct the endpoints automatically to include version & project information (default) or as per the FJ guides (optional). If you are new to K5 API and are looking to follow the guides, then it my be worth setting ‘EPFULL=false’ while you get started 🙂


I’ve decided to leave the below example files within this updated blog for reference purposes, for anyone who is already using these templates or for those people who would prefer to follow along with the FJ guides. Personally I have already switched over to using the above script. file template:

and below for example


***********************Updated 19/04/17***********************
As an alternative to Cygwin, you may want to use a free utility called MobaXterm. This is quicker to install and setup, and also includes a SSH client.

To install:
1. Download the MobaXterm Installer from
2. Extract download zip file and run MobaXterm_installer.msi
3. Welcome | Next
4. License | tick ‘I accept…’ | Next
5. Accept default destination folder | Next
6. Click ‘Install’
7. Click ‘Finish’
8. Browse to
9. Download and copy the curl plugin to the MobaXterm folder C:\Program Files (x86)\Mobatek\MobaXterm
a. Other plugins can be added depending on your requirements. Typically I also install :
DnsUtils Git, Gvim, OpenSSL, Python, Zip

10. Click on Start menu, locate and click on MobaXterm to open the utility
11. Within MobaXterm window, click on ‘Start Local Terminal’
12. Install JQ by entering the command: apt-get install jq


How to use a FUJITSU K5 Key Pair with PuTTY/PSFTP

How to use/convert your K5 Key Pair key to work with Putty

Putty does not natively support the Fujitsu K5 KeyPair PEM file format. In order to use this KeyPair with Putty, it must first be converted to PPK format using the tool PuttyGen. Both Putty and PuttyGen can be downloaded freely from:

  1. Download the ‘puttygen.exe’ file from the above link and save it somewhere suitable
  2. Double click the ‘puttygen.exe’ file to start the application and select ‘Run’ if prompted with a security warning. (Note: There is no installation of this application)
  3. In the resulting window, under ‘Parameters’ ensure ‘SSH-2RSA’ is specified as the ‘Type PSof key to generate’
  4. Under ‘Actions’, click‘Load’. Then in the ‘Load private key:” window, change the file type drop down box to ‘All Files’.
  5. Next browse to and select your K5 Key Pair PEM file and click ‘Open’, then click ‘OK’ to acknowledge any Notice dialog boxes
  6. Click‘Save private key’, then ‘Yes’ to warning about not having a passphrase to protect the key
  7. Next specify a location for the new file to be created, ensuring the same name is used for the PPK file, as was used for the PEM file. (Note: The .ppk file extension is automatically added to the filename). Click ‘Save’ to create the file and to complete the conversion process
  8. PuttyGen can now be closed

How to connect to a Fujitsu K5 Linux VM using Putty

Once you have a Fujitsu K5 Key Pair in PPK format, it can be used to authenticate with K5, using the common SSH client tool – PuTTY.

  1. Download ‘putty.exe’ from the previous link and save it somewhere suitable
  2. Double click the ‘putty.exe’ file to start the application and select ‘Run’ if prompted with a security warning. (Note: Again there is no installation of this application)
  3. In the resulting window under ‘Session | Host Name (or IP Address)’, enter the public facing IP Address of the Linux VM
  4. Next expand ‘Connection | Data’ and enter the username for the VM, that you are wanting to login with i.e. ‘k5user’ for Win/Centos/Red hat & ‘ubuntu’ for Ubuntu. Note: Ensure that the appropriate Security Group and Firewall rules have been opened to allow a SSH connection from your IP Address. Configuration of this is out of scope of this guide
  5. Then expand ‘Connection | SSH | Auth’ and click the ‘Browse’ button, before browsing to and selecting your PPK file and clicking ‘Open’
  6. At this point, it is a good idea to save this configuration so that it can be re-used again. To do this, skip back to the very top category ‘Session’, and under ‘Saved Sessions’ enter a name for this particular connection and click ‘Save’. This saved session will also be used by the file transfer tool PSFTP, (see next section)
  7. Finally, click ‘Open’ to establish the SSH connection

How to transfer files to a Fujitsu K5 Linux VM using PSFTP

PSFTP is another tool that can be used to securely transfer files to and from a K5 Linux VM. In order to successfully authenticate with the VM using a keypair, PSFTP must reference the name of the saved Putty session, rather than an IP Address or Hostname.

  1. Download the ‘psftp.exe’ file from the earlier link and place it in a folder that is included in the system path e.g. c:\windows\system32.
  2. From a Windows command prompt, enter the command ‘psftp’ followed by the name of the saved putty session e.g.
  3. This will authenticate psftp with the VM using the IP Address, username and keypair information saved within the saved putty session.
  4. Now that psftp is connected, it is possible to navigate both the local workstation and remote Linux VM. Proceed each Windows CMD commands with a “!” character e.g. “!dir” – to list the contents of the current directory.
  5. The ‘put’ command can be used to transfer files to the VM, e.g. in the case of Red Hat, this method can be used to transfer the RHUI agent file to the VM.
  6. Once the file is copied to the VM, the psftp session can be closed by typing ‘Quit’.