I have custom Linux that I can boot up on AWS and GCP. In AWS I can check EC2 instance type easily from terminal:
aws-instance-xyz:/ # dmidecode -s system-product-name
m6i.4xlarge
I would like to be able to check instance type of compute engine in GCP however dmidecode command is of no use here:
gcp-instance-xyz:/ # dmidecode -s system-product-name
Google Compute Engine
I have to be able to check the instance type using a command in terminal. I can't install GCP cli on that linux environment so any gcloud/gutils commands are not an option.
As per this official doc
sudo dmidecode -s system-product-name
is used to detect if the VM is running in Compute Engine.To get the metadata details you need to use the
curl
command as mentioned in this official doc.Use the below command to get instance type:Output:
It will be flexible if you use gcloud and adding here the installation document for your reference.