I’m trying to run a simple node.js script to describe an instance, but I get:
module.js: 340
Error: Cannot find module ‘aws-lib’
I have all the EC2 node.js library files in the same directory as the script, but how do I include them?
var aws = require("aws-lib");
ec2 = aws.createEC2Client(*redacted*, *redacted*);
ec2.call("DescribeInstances", {}, function(err, result) {
console.log(JSON.stringify(result));
});
You don’t install the module actually. Go the folder where your node application exists, then install the module there, like:
These commands will create a folder called
node_modulesin your application folder. Then you can useaws-lib.