cloud-detect
is a Python module that determines a host's cloud provider. Highly inspired by the Go based Satellite, cloud-detect
uses the same techniques (file systems and provider metadata) to properly identify cloud providers.
>>> from cloud_detect import provider
>>> provider()
'aws'
>>> provider() # when tested in local/non-supported cloud env
'unknown'
Right now the only possible responses are: 'alibaba', 'aws', 'azure', 'do', 'gcp', 'oci', 'vultr' or 'unknown'
You can get the list of supported providers using
>>> from cloud_detect import SUPPORTED_PROVIDERS
Via pip:
pip install cloud-detect
Termination-handler uses cloud-detect to keep the handling of termination notices on spot/preemptible instances cloud-agnostic, making easier to operate the same tooling in various distinct environments.
Some things that would be great to have: