Find host’s cloud provider in node.js
I came across a npm package called cloud-detect that lets you find the name of the cloud provider in a node.js application.
Install the cloud-detect npm package in your node.js application.
npm install --save cloud-detect-js
Then use it in your code like..
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' })();