SaltwaterC edited this page Jan 27, 2012 · 8 revisions


This is the low level method that makes the AWS query APIs requests.


query.request(action, [query], callback)
  • 'action' - the action argument required by each specific query API (eg: EC2, RDS, etc.).
  • 'query' - optional argument. Must be an object containing the parameters of the query API.
  • 'callback' - callback argument that is executed when the processing finishes. Has a couple of arguments: error and response. For more details follow: HTTP Errors, XML Parser.
  • If there's an error, the callback receives the error argument as Error instance.
  • If the error argument is null, then the response argument contains a JavaScript object containing the requested data. The library parses the XML returned by the AWS API.

The query argument is just a simple key - value hash table. It doesn't support argument nesting. Internally it is parsed by node's querystring.stringify(). Therefore, you must be careful when constructing the query object. Refer to the specific query API from the Amazon documentation in order to figure out which are the appropriate values for a given action.

The passed query key - values pairs take precedence over the embedded values, therefore you may override from the request() call certain parameters. For example, you may pass something like {Version: 'YYYY-MM-DD'} in order to change on the fly the query API version number for a certain call.