Coder Social home page Coder Social logo

node-ec2's People

Contributors

bigeasy avatar flatheadmill avatar glennschler avatar pkrumins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-ec2's Issues

Specify request host?

Hi,

How about being able to specify the host when calling the createClient() factory function?

Specifying the host should allow folks to use this library for other AWS services besides EC2. As an example, I'd like to use this library for the new Simple Email Service (SES).

Do you know of any other roadblocks I might run into here? Well, I'm gonna fork this and try it out...

Cheers,

Zach

Create `CHANGELOG`.

I'll forgive you if you don't weed through your sad commit logs and recreate earlier "releases".

Delete Twinkie.

This library no longer requires compilation. The older version of Twinkie is causing errors at Travis CI. Remove from .gitmodulesand .travis.yml. Remove CoffeeScript frompackage.json`.

DescribeInstances

How does one do a filter on DescribeInstances?

ec2("DescribeInstances", { F: 'tag-key=Env' } ?

Possible to create secure minimal API test?

Would it be possible to use a custom API key that has severely limited permissions to test the API against Amazon itself? I could query key pairs, or something, to get a list of key pairs.

Unable to trap request connection error

It can happen that the http request to the EC2 web service times out. When that occurs, there is no way for the caller to trap the event.

Specifically, I have obtained an unexpected error 10006 (timeout) several times, and this is causing the node process to crash. Please add code to trap a request error and expose it via the existing error event.

Not able to override endpoint as the first argument to the Node EC2 function.

This test fails. README indicates that node-ec2 should allow overriding of the configuration endpoint. With this test, it shows that us-east-1 is still requested instead of intended us-west-2 override.

I believe I see the resolution in the amazon.js file. I will submit pull to resolve issue #31, before discussing this issue further.

var fs = require('fs');
var configurationPath = './.aws';

// Read in the configuration above.
var configuration = JSON.parse(fs.readFileSync(configurationPath, 'utf8'));
configuration.endpoint = "us-east-1";

var ec2 = require("ec2")(configuration)

var parameters = {};

ec2({ endpoint: "us-west-2" }, "DescribeAvailabilityZones", 
              parameters, function (error, result) {
  if (error) throw error;
    console.log(result)
});

Error: getaddrinfo ENOENT

i have this:

$ node app.js                                                                                                                                                                  ""

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: getaddrinfo ENOENT
    at errnoException (dns.js:31:11)
    at Object.onanswer [as oncomplete] (dns.js:140:16)

here is the code:

var ec2 = require("ec2")
, fs = require("fs");

// Read in the configuration above.
var configuration = JSON.parse(fs.readFileSync("configuration.json", "utf8"));

// Create an ec2 function that uses your configuration.
ec2 = ec2(configuration)

// Run an instance and wait for it to become ready.
ec2("RunInstances", {
  ImageId: "ami-5d704b29", KeyName: "micros-ie", InstanceType: "t1.micro"
}, function (error, response) {
  if (error) {
    throw error
  }
  reservationId   = response.reservationId;
  instanceId      = response.instancesSet[0].instanceId;
  ready = function () {
    ec2("DescribeInstances", function (error, struct) {
      if (error) {
        throw error;
      }
      var reservation = struct.reservationSet.filter(function (reservation) {
        return reservation.reservationId == reservationId;
      })[0];
      var instance = reservation.instancesSet.filter(function (instance) {
        return instance.instanceId == instanceId;
      })[0];
      return instance.instanceState.name == "running";
      if (instance.instanceState.name == "running") {
        console.log("Instance created with id: " + instanceId);
      } else {
        setTimeout(ready, 500);
      }
    });
  };
  ready();
});

Update `README.md`.

The README.md should say something about the new API, instead of saying nothing about the new API.

ec2 API wsdl 2012-10-01 has been released

node-ec2 has the wsdl version hard coded to an old version when you send the query string request. Noticed when DescribeSpotInstanceRequests API Action was not returning what was documented by aws.

Create JSON parser input.

When you get output from the ec2 program as JSON. Save it. Then echo it back through ec2 to get the fields.

Unexpected token error \u0000 when installing with npm

I see this error on Lion, but it's fine on ubuntu

$ sudo npm install ec2
npm http GET https://registry.npmjs.org/ec2
npm http 304 https://registry.npmjs.org/ec2
npm http GET https://registry.npmjs.org/ec2/-/ec2-0.1.0.tgz
npm http 200 https://registry.npmjs.org/ec2/-/ec2-0.1.0.tgz
npm ERR! error reading /tmp/npm-1335796170160/1335796170160-0.39644423476420343/package
npm ERR! couldn't pack /tmp/npm-1335796170160/1335796170160-0.39644423476420343/package to /Users/auser/.npm/ec2/0.1.0/package.tgz

npm ERR! SyntaxError: Unexpected token
npm ERR! at Object.parse (native)
npm ERR! at Packer.readRules (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/fstream-npm.js:179:33)
npm ERR! at Packer. (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:132:22)
npm ERR! at [object Object]. (fs.js:115:5)
npm ERR! at [object Object].emit (events.js:64:17)
npm ERR! at afterRead (fs.js:1117:12)
npm ERR! at Object.wrapper as oncomplete
npm ERR! You may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]
npm ERR!
npm ERR! System Darwin 11.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "ec2"
npm ERR! cwd /Users/auser/dev/myapp
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.18
npm ERR! file /tmp/npm-1335796170160/1335796170160-0.39644423476420343/package/.AppleDouble/package.json
npm ERR! path /tmp/npm-1335796170160/1335796170160-0.39644423476420343/package/.AppleDouble
npm ERR! type unexpected_token
npm ERR! fstream_path /tmp/npm-1335796170160/1335796170160-0.39644423476420343/package/.AppleDouble
npm ERR! fstream_type Directory
npm ERR! fstream_class Packer
npm ERR! arguments [ '\u0000' ]
npm ERR! message Unexpected token
npm ERR! fstream_stack Packer.readRules (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/fstream-npm.js:182:10)
npm ERR! fstream_stack Packer. (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:132:22)
npm ERR! fstream_stack [object Object]. (fs.js:115:5)
npm ERR! fstream_stack [object Object].emit (events.js:64:17)
npm ERR! fstream_stack afterRead (fs.js:1117:12)
npm ERR! fstream_stack Object.wrapper as oncomplete

Authentication issues

Does this module still work? I am asking because I can't get it to authenticate. I am always getting:

{ Errors: 
   [ { Code: 'SignatureDoesNotMatch'
     , Message: 'The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.'
     }
   ]
, RequestID: 'b1f6c04a-e249-4ca1-967b-bcb1915ec1e0'
}

Any ideas what might cause it to fail? I tried creating a new key and it still didn't work.

Here is the code that I have:

var ec2 = require('ec2');

var client = ec2.createClient({
    key : '... my key ...',
    secret : '... my secret ..'
});

client.call("StartInstances", { InstanceId : "i-b6ab03db" }, function (resp) {
    console.log(resp);
});

client.on("end", function () {
    console.log('end');
});

client.on("error", function (err, code) {
   console.dir(err);
   console.log(code);
   console.log('----')

});

client.poll("DescribeInstances", function (struct) {
console.log(struct);
return true;
});

client.execute();

Thank you!

Convert to XML DOM.

Convert the library to XML DOM library XMLDOM. It is being maintained actively.

DELETE THIS REPO.

For those of you watching this repo, it is going to be deleted soon and from NPM as well.

Not a string or buffer?

Hi,

Not sure what this error is being caused by, I run "node amazon-test.js":

var stack = require('../lib/long-stack-traces'); 
var ec2 = require('ec2');

var client = ec2.createClient({ 
    key: process.env['key'], 
    secret: process.env['secret']
});

client.poll("DescribeInstances", function (struct) {
    console.log(struct);
    return true;
}); 
client.execute();

This returns an error at line 40, which is really "client.execute()" after cleaning up some code:
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Not a string or buffer
at Object.createHmac (crypto.js:103:21)
at /node_modules/ec2/lib/request.js:53:19
at AmazonEC2Client. (/node_modules/ec2/lib/amazon.js:53:16)
at AmazonEC2Client.execute (/node_modules/ec2/lib/amazon.js:3:63)
at Object. (amazon-test.js:40:8)
at Module._compile (module.js:404:26)
at Object..js (module.js:410:10)
at Module.load (module.js:336:31)
at Function._load (module.js:297:12)
at Array. (module.js:423:10)

Populate `.npmignore`.

This addresses an issue with the 0.1.0 release where .AppleDouble directories where added to the NPM tarball.

crypto.js error - variation b/t CentOS EC2 instances

Hi,

I created a CloudWatch library yesterday based on node-ec2 library and simple-rest-client, https://github.com/franklovecchio/node-cloudwatch, but I see an interesting error with a particular newer version of CentOS on EC2 with the same dependencies installed. I created a ticket for myself here:

https://github.com/franklovecchio/node-cloudwatch/issues/1

I'm not sure what dependency is different - maybe you have experienced this with node-ec2?

Thanks!

load configuration.json securely

hello,
i got this to work, but have some questions.

basically, it checks if a site is running
var http = require('http')
, url = require('url')
, util = require('util')
, exec = require('child_process').exec;

var site = http.createClient(80, "www.domain.tld", false);
var req = site.request("GET", "/");
req.end();
req.on('response', function(res){
    if(res.statusCode !== 200){
        // launch a new instance
        var ec2 = require("ec2")
            , fs = require("fs");
        // Read in the configuration above.
        var configuration = JSON.parse(fs.readFileSync("configuration.json", "utf8"));
        // Create an ec2 function that uses your configuration.
        ec2 = ec2(configuration)
        // Run an instance and wait for it to become ready.
        ec2("RunInstances", {
            ImageId: "ami-XXXXXX"
            , KeyName: "micros-ie"
            , InstanceType: "t1.micro"
            , MinCount: 1
            , MaxCount: 1
        }, function (error, response) {
            if (error) {
                throw error
            }
        });
        } else {
            res.on('data', function(chunk){
            function puts(error, stdout, stderr) { util.puts(stdout) }
              exec("my command", puts);
            }); 
        }
});

basically, i want to start my first instance from my local computer and then chain the second, third ... etc so for example, when the 'site' returns a non 200 OK status code, i want to fire up a new EC2 instance, thus i don't have to have my local machine connected

is there a better way to do this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.