I’m interested in going from the console/portal for a given cloud to using the command line interface (CLI). I plan to use an AI Coding Assistant to work my way up the learning curve for this; but just to get started do you have any tips or examples?
Great question Rob! It corresponds well with the shift in CloudBank 2 messaging, what we have to say to cloud adopters in academic research.
Here at CloudBank we point new users to the cloud portal/console at the outset. This is to get the hang of cloud computing in terms of configurable services in the pay-as-you-go model. However we recommend switching to the Command Line Interface (CLI) when it makes sense. The CLI enables you to repeat / modify your steps building infrastructure in a controlled deliberate manner. The jargony operative term is ‘Infrastructure as Code’: Your commands can be written into bash scripts that you can edit and re-run. This is an engineering approach than avoids the “how did I do this?” feeling of uncertainty we get from guessing and clicking our way through console/portal Create wizards.
The down side is that this means another learning curve on your plate; so it is a good idea to be sure it will be worth your time and effort. And this ‘worthwhile to learn the CLI?’ question in turn depends upon the complexity of the computing environment you need to build on the cloud.
By the way: For AWS, Azure and GCP the respective CLI commands are aws, az, and gcloud; just for starters. These are the commands you install on your Build machine; which might be your laptop or could be a cloud-based VM or wherever. Once the CLI is installed there will be some sort of authentication procedure to go through since running the cli often implies spending money. And for the record your localhost CLI commands operate by means of an API.
You mention using an AI Coding Assistant. This has the advantage (in my experience) of allowing you to explore and learn the CLI from your current level of skill and sophistication, at your natural pace. Coding Assistants are also often successful in debugging situations. With or without an AI: One thing I strongly recommend is to timegap-proof your learning process: Open a text file and record what you learn and how you build as you go. This learning record will help internalize the technical machinery in your long-term memory; and should you need to pause the cloud building work for a week or a month: You can use this document to jumpstart your mindset when you eventually return to the task. My personal First Law of AI is: AI may yield an apparent 10x increase in productivity (just to pick a number) but this rapid progress will create a need for additional engineering thought and effort, in effect dropping the productivity level back to 5x. Now at 5x we are still way ahead of the pre-AI game; so take that time to keep the project well-managed by you (not the AI).
Finally you asked for an example, so here is one using the Azure CLI az. This example illustrates the Azure cloud listing VM instances with fewer than 4 cores and less than 8GB of RAM:
az vm list-sizes --location westus --query '[?memoryInMb<`8000` && numberOfCores<`4`]' --output table
A couple things to note about this example: It begins with the az invocation and immediately provides the vm context qualifier: This command will concern Virtual Machines. The query specifies the westus region since regions are unique. There is some finesse in the syntax of the query string with quotes and back-ticks. And finally the result is a text table but we could also have specified json or yaml.
So to wrap this up: Here we had an example of translating the question “What are my options for low power / low memory (low cost) VMs on Azure?” into an Azure CLI command producing answers. This is a first step on the road to becoming a Next Level Cloud Infrastructure Builder. CloudBank’s exhortations for those who follow this road are: Do use an AI Coding Assistant to learn as you go, and do record your progress and key insights in a breadcrumb document preferably safely copied into a GitHub repository. (Reading between the lines: Don’t outsource understanding what you are doing to the AI!)