Node JS NPM shell scripting

Find the host’s cloud provider using Node.Js

If you ever wanted to inject or use cloud provider-specific code in the codebase or DevOps work, You can now do it very easily thanks to cloud-detect-js(https://github.com/vithalreddy/cloud-detect-js#readme) Node.js Module, which helps to determine host machine’s cloud provider using machine’s file system and metadata.

Detect Host’s Cloud Provider

This Module Provides a very simple API as follows:

const { cloudProvider } = require('cloud-detect-js');

(async () => {
  await cloudProvider();
  // wil return one of  'aws', 'gcp', 'azure', 'oracle', 'alibaba', 'do' or 'unknown'
})();

It also has an cli version

Via NPM:

npm install -g cloud-detect-js
Via Yarn:

yarn add global cloud-detect-js

Usage: cloud-detect-js  

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

It can also be downloaded from NPM @ https://www.npmjs.com/package/cloud-detect-js

READ  Push and Pop Items Into MongoDB Array Via Mongoose in Node.js

About the author

Vithal Reddy

Vithal Reddy is a seasoned technology professional with expertise in Full Stack Web development, Micro services and Scaling infrastructure on Cloud.
More at vithalreddy.com