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-version
Is there a generic and more reliable approach for finding this?
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.
Here is a piece of code using which you can detect the popular bare metal vendors like AWS, Azure, Google Cloud and Oracle. This will return None if it cannot detect cloud. https://github.com/nithinj/cloud_what