Troubleshooting image OS

It seems that some Image IDs do no show up anymore when called from OCI CLI

The documentation still mentions about their existence, though.

If you do get an empty output for image OS when running the script test_env_variables.sh. ...

variable "instance_image" {
   default = ""
}

... then, that specific Image OS that is called by the script is not available anymore (at least when called from OCI CLI)

Initially, when generating the Image OS ID, I was looking for a specific Ubuntu OS: Canonical-Ubuntu-20.04-2021.01.25-0

Practice time

From the Cloud-Shell:

a) generate Tenancy as environment variable:

 TENANCY=$(oci iam compartment list --access-level ACCESSIBLE |\
 grep -i tenancy | \
 awk 'NR==1{print $2}' | \
 sed -e 's/,//g' -e 's/"//g')

check if any output:

echo $TENANCY
ocid1.tenancy.oc1..aaaaaaaahereisyourtenancyID

b) generate the image OCID as environment variable (this time, for image OS Canonical-Ubuntu-20.04-2021.01.25-0)

var_image_os=$(oci compute image list --all \
--output table --compartment-id $TENANCY | \
grep "Canonical-Ubuntu-20.04-2021.01.25-0"  | \
awk {'print $16'})

check if any output (output from Dubai region):

zack@cloudshell:~ (me-dubai-1)$ echo $var_image_os

zack@cloudshell:~ (me-dubai-1)$ 

No output...

Good!

Now let's list what are all the available images for "Canonical-Ubuntu-20.04-2021" of that specific tenancy:

zack@cloudshell:~ (me-dubai-1)$ oci compute image list --all --output table --compartment-id $TENANCY | grep "Canonical-Ubuntu-20.04-2021"  | awk {'print $12, $16'}
Canonical-Ubuntu-20.04-2021.04.15-0 ocid1.image.oc1.me-dubai-1.aaaaaaaa3wp4iu2q6btlxz4xvjqbdoe6odaecj6en7ygg3ltimps67aaeqfq
Canonical-Ubuntu-20.04-2021.03.25-0 ocid1.image.oc1.me-dubai-1.aaaaaaaakymk4j6nkwer37kw2gsrzsbhoosqnckz6hmsmdpzr42ie5hlitga
Canonical-Ubuntu-20.04-2021.02.15-0 ocid1.image.oc1.me-dubai-1.aaaaaaaajhivl4i4xsvw2uzyis65j3272uxnr5asvssfu2pz6eosurlj2gga
zack@cloudshell:~ (me-dubai-1)$ 

So, we have three images & their IDs:

Canonical-Ubuntu-20.04-2021.04.15-0
Canonical-Ubuntu-20.04-2021.03.25-0
Canonical-Ubuntu-20.04-2021.02.15-0

No sign of Canonical-Ubuntu-20.04-2021.01.25-0, which was initially used.

Test for new Image OS

Tested in Frankfurt region

a) Tenancy

 TENANCY=$(oci iam compartment list --access-level ACCESSIBLE |\
 grep -i tenancy | \
 awk 'NR==1{print $2}' | \
 sed -e 's/,//g' -e 's/"//g')

b) This time, using the Canonical-Ubuntu-20.04-2021.03.25.0 to extract the Image ID

var_image_os=$(oci compute image list --all \
--output table --compartment-id $TENANCY | \
grep "Canonical-Ubuntu-20.04-2021.03.25-0"  | \
awk {'print $16'})

c) Check if environment variable provides output:

zack:~ (eu-frankfurt-1)$ echo $var_image_os 
ocid1.image.oc1.eu-frankfurt-1.aaaaaaaa43mhnlbh4kyx6wxr3e2bvahuplycudwkrruopismoiy2goqiiszq

The repository scripts are already adapted to Canonical-Ubuntu-20.04-2021.03.25-0.

However, if you do meet the empty field in the future for instance_image, now you know how to troubleshoot it, and how to replace your Canonical Ubuntu Image OS with an available one.

Fini!

Last updated