When it comes to development on the IBM Cloud, the ‘ibmcloud’ CLI tool is really useful. For those that are not familiar with the tool, it’s a package which you can install on your local machine, that gives you the ability to interact with the IBM Cloud from your local command line, without the need to log into the full console.
As mentioned, to use the CLI tool, you need to install it onto your local machine. However, a number of clients have been telling me that their local machines are locked down by Enterprise-wide settings, which means that they are unable to install the tool and use it. This isn’t unusual in organizations where users are provided machines with standard builds, which the IT Department supports. In such cases, there’s usually a process to go through to have new software approved, which may include a level of testing against a build and other approvals. This can take time!
I’ve been thinking about ways to help those users stuck without the CLI.
What I have done is create a very basic virtual machine in my IBM Cloud account and install the CLI tools onto that. This works well and assuming that the developer has ssh access from their local machine, this is a great solution.
So, how to do this? Well, to make it really easy, I created a Public Image Template which can be used by anyone to create a new Virtual Server Instance, with everything they need to get going with the CLI installed.
To use the Public Image Template, follow these steps:
- Log into your IBM Cloud account
- In the top left corner, click the ‘hamburger’ icon and select ‘Infrastructure’ from the drop-down menu (you can shortcut this step by just hitting control.bluemix.net)
- Click Devices -> Manage -> Images from the left-hand menu
- This will show your Image Templates. Where it says ‘Private Images’, select ‘Public Images’ from the drop-down
- Look for a template called Simple Ubuntu VM with IBM Cloud CLI. Note, this page does not have a simple ‘search’ function, so it may be easier to order the templates by ‘Create Date’ (click on the heading) – the template was created on ‘2018-10-10’.
- Click on ‘Actions’ and select one of the ‘Order’ options. This will open an order form.
- Select the data centre where you would like the VM to reside. Normally, this would be the one closest to your physical location, or perhaps closest to your IBM Cloud deployment if they are different.
- Then pick a Flavour option. Since this is going to be a pretty lightweight machine, I would choose the top option (C1) from the Compute flavours, as this tends to be the cheapest.
- Scroll to the bottom and click ‘Add to Order’
- This takes you to the ‘Check Out’ screen. Under the Advanced System Configuration settings, provide a hostname for your virtual server and a domain.
- Click the two check boxes to acknowledge T&Cs and License terms, then click Submit Order. At this point, your machine will start provisioning.
- Go back to your list of devices (click Devices -> Device List from the left-hand menu). You will see your machine is provisioning (denoted by a ‘clock face’ icon beside it.
- When the machine is provisioned, you will see a Public IP address (as well as a Private one) beside its name. Click on the name of the server.
- Open a terminal on your local machine and use ssh to connect to the server, as follows (substituting the ‘xxx’ with your server’s Public IP address:
- Provide the password for the user – the default is cliUSERPASSWORD! (case sensitive)
NOTE It is strongly recommended that you change the cliuser password on your image, particularly if it persists for some time, since EVERY server created using this template will have this password as a default. To do this for cliuser, type:
- You are now good to go and can use the IBM Cloud CLI (just type ‘ibmcloudcli help’ to see a list of commands)
What does the image include?
The image has the IBM Cloud CLI installed, including the dev, container-service and container-registry plugins. It also has Docker installed. These may need updating from time to time but the CLI will prompt as they are used.
- Think about how long your Virtual Machine might be needed for. Could you save money by provisioning a new machine each time you need it (note it can take up to 20 minutes) or by using Transient Virtual Servers?
- If you need to lock down access to the VM, consider using Security Groups and restricting access to a set IP address range, for example.
You can find a full list of IBM Cloud CLI commands here
Want a Windows desktop with a richer set of tools installed? Check out this post!