Wednesday, 23 February 2022

TIL - Logging into IBM Cloud with fewer keystrokes

So, back in the day i.e. earlier today, this is how I'd log into IBM Cloud: -

ic login --apikey $(cat ~/keyfile_staging_payg.json | jq -r .apikey) -r us-south -a 

where I'm using cat and jq to parse a JSON document containing my API key: -

cat ~/keyfile_staging_payg.json | jq -r .apikey

Well, today I learned that I can do it in fewer keystrokes ...

ic login --apikey @keyfile_staging_payg.json -r us-south -a https://test.cloud.ibm.com

In other words, I'm using @ rather than a combination of cat and jq.

Now, personally, I use aliases to make life even easier e.g.

testlogin='ic login --apikey @~/keyfile_staging_payg.json -c 19f41865a1cf430c918334d89f6b09b9 -r us-south -a https://test.cloud.ibm.com'

where said aliases are defined in ~/.bash_profile or ~/.zshenv.

All of which is nice!


No comments:

Reminder - installing podman and skopeo on Ubuntu 22.04

This follows on from: - Lest I forget - how to install pip on Ubuntu I had reason to install podman  and skopeo  on an Ubuntu box: - lsb_rel...