Skip to content

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'
See also  LeetCode challenge - Can Place Flowers - Java Solution

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.