Here you can find several recipes that you can run cloud shell that hopefully can save you making clicks back and forth in the dashboard.

INSTALL OCI CLI WITH HOMEBREW
brew install oci-cli
GET THE OCID OF THE TENANCY
oci iam availability-domain list --all | jq -r '.data[0]."compartment-id"'
RETRIEVE THE HOME REGION
oci iam region-subscription list | jq -r '.data[0]."region-name"'
GET THE BASE URL OF OBJECT STORAGE IN HOME REGION
namespace=$(oci os ns get | jq -r .data) home=$(oci iam region-subscription list | jq -r '.data[0]."region-name"') echo "https://objectstorage.$home.oraclecloud.com/n/$namespace/b/<bucketname>"
GET THE LIST OF SUBSCRIBED REGION NAMES AND KEYS
oci iam region-subscription list | jq '.data[]."region-name" | .data[]."region-key"'
LIST MACHINES IN RUNNING (OR WHATEVER) STATE IN THE WHOLE TENANCY
rm deeplist.sh wget https://raw.githubusercontent.com/javiermugueta/rawcontent/master/deeplist.sh chmod 700 deeplist.sh ./deeplist.sh ./deeplist.sh RUNNING ./deeplist.sh STOPPED


CREATE POLICY AT ROOT LEVEL
TENANCY=$(oci iam availability-domain list --all | jq -r '.data[0]."compartment-id"') oci iam policy create --compartment-id $TENANCY --name <policyname> --statements '["sentence1", "sentence2"]' --description <policydescription>
CREATE IAM USER + ADD USER TO AN EXISTING GROUP + CREAtE and assign api key
rm iamuser.sh https://raw.githubusercontent.com/javiermugueta/rawcontent/master/iamuser.sh chmod 700 iamuser.sh ./iamuser.sh pepitor Administrators

START/STOP OKE CLUSTER WORKER NODES
git clone https://github.com/javiermugueta/oke-cluster-start-stop.git cd oke-cluster-start-stop # k: oke clustername # c: compartment # o: start/stop ./oke-cluster-start-stop.sh -r=eu-frankfurt-1 -c=invictuspre -k=k8sdesa -o=start # ./oke-cluster-start-stop.sh -r=eu-frankfurt-1 -c=invictuspre -k=k8sdesa -o=stop
Hope it helps! 🙂
One Comment