cloud-detect-js
is a Node.JS module that determines a host's cloud provider. Highly inspired by the Go based Satellite, cloud-detect-js
uses the same techniques (file systems and provider metadata) to properly identify cloud providers. Currently Supports AWS, GCP, Azure, Alibaba, Oracle, and Digital Ocean Cloud Providers.
Via NPM:
npm install --save cloud-detect-js
Via Yarn:
yarn add cloud-detect-js
const { cloudProvider } = require('cloud-detect-js');
(async () => {
await cloudProvider();
// wil return one of 'aws', 'gcp', 'azure', 'oracle', 'alibaba', 'do' or 'unknown'
await cloudProvider();
// 'gcp'
await cloudProvider(['aws', 'oracle']); //excluded
// 'unknown'
})();
Via NPM:
npm install -g cloud-detect-js
Via Yarn:
yarn add global cloud-detect-js
Usage: cloud-detect-js [options] [command]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
detect|d Detect's Host Machine's Cloud Provider
cloud-detect-js d
# aws
cloud-detect-js detect
# gcp