Presently I'm checking by running dmidecode -s bios-version and grepping against major cloud vendors. Ex:# From an amazon ec2 VM$ sudo dmidecode -s bios-version4.2.amazonIs there a generic and more reliable approach for finding this?
Detect whether a Linux execution host is cloud based or not
linux;cloud;dmidecode
There is no standard mechanism by which cloud vendors inject identification into running virtual machines.  If your goal is to detect whether or not your are running in a virtual environment you could use the virt-what command, but there is no good way to differentiate one cloud vendor from another.