Skip to content

Test if the current Node process is running on AWS EC2

Notifications You must be signed in to change notification settings

dvonlehman/is-ec2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

is-ec2

Sometimes you need to know if you are running on EC2 or not. This will tell you.

npm install is-ec2
var isec2 = require('is-ec2');

if (isec2()) {
  console.log('yep');
}

This works by executing the following command:

if [ -f /sys/hypervisor/uuid ]; then echo `head -c 3 /sys/hypervisor/uuid`; fi

Only work on Linux EC2 instances, not Windows. See this StackOverflow article for details.

About

Test if the current Node process is running on AWS EC2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published