Release: AWS SDK for Node.js v0.9.2-pre.3

This release adds support for Amazon Simple E-mail Service, Amazon Simple Queue Service, and Amazon Elastic Transcoder. Also improves request handling by adding support for events, buffers, and streaming.


Created On: January 29, 2013
Last Updated: October 09, 2017


Latest Version

npm install aws-sdk

New Features

Change Description
Amazon Simple E-mail Service

Added support for Amazon Simple E-mail Service (AWS.SES). Example usage:

var ses = new AWS.SES({region: 'us-east-1'});
ses.getSendQuota(function(err, data) {
  console.log(err, data);
});
Amazon Simple Queue Service

Added support for Amazon Simple Queue Service (AWS.SQS). Example usage:

var sqs = new AWS.SQS({region: 'us-west-2'});
sqs.client.createQueue({QueueName: 'myQueue'}, function(err, data) {
  if (!err) {
    console.log("Created queue", data.QueueUrl);
  }
});
Amazon Elastic Transcoder

Added support for Amazon Elastic Transcoder (AWS.ElasticTranscoder). Example usage:

var transcoder = new AWS.ElasticTranscoder();
transcoder.client.listPipelines(function(err, data) {
  console.log(err, data);
});
Changed Request Callbacks to Events

Changed behaviour of request and response objects to emit events instead of callbacks. This affects the use of the done, fail, always, and data callbacks inside of request calls. For instance, the following v0.9.1-pre.2 code:

dynamodb.client.listTables().
  done(function(resp) { ... }).
  fail(function(resp) { ... }).
  always(function(resp) { ... }).
  data(function(resp) { ... }).
  send();

Should now be written as:

dynamodb.client.listTables().
  on('success', function(resp) { ... }).
  on('error', function(error, resp) { ... }).
  on('complete', function(resp) { ... }).
  on('httpData', function(chunk, resp) { ... }).
  send();

See the documentation for information on the available events and their parameters. Note that the AWS.AWSRequest and AWS.AWSResponse have been renamed to AWS.Request and AWS.Response respectively.

Renamed AWSRequest & AWSResponse

The AWS.AWSRequest and AWS.AWSResponse have been renamed to AWS.Request and AWS.Response respectively.

Moved httpRequest Response Property

Moved the AWS.Response.httpRequest property into AWS.Request.httpRequest

Request Streaming Reads

Added AWS.Request.createReadStream() to stream HTTP data from a request. For example:

var s3 = new AWS.S3();
var params = {Bucket: 'myBucket', Key: 'myImageFile.jpg'};
var file = require('fs').createWriteStream('/path/to/file.jpg');
s3.client.getObject(params).createReadStream().pipe(file);
AWS_REGION Environment Variable Support

You can now use the AWS_REGION environment variable to set a default region. For example:

$ AWS_REGION=us-west-2 node
> AWS = require('aws-sdk');
> AWS.config.region
'us-west-2'
Amazon S3 Error Handling

Updated how AWS.S3.Client handles errors with no HTTP response body. Canned errors are no longer used if a response body is present. Support for 400 (BadRequest) responses was also added.

Amazon DynamoDB CRC Checking

Added CRC checking to DynamoDB requests. You can disable CRC checking by setting dynamoDbCrc32 config setting to false:

var db = new AWS.DynamoDB({dynamoDbCrc32: false});
Buffer & Stream Payloads

Added support Buffer & Stream payloads in REST services.

The "Body" payload property of REST-based services (like Amazon S3) will now return Buffer objects instead of Strings, which allows for the downloading of binary data:

s3.client.getObject({Bucket:'foo',Key:'bar'}, function(err, data) {
  console.log(data.Body); // data.Body is now a Buffer object
});

In addition, you can now assign a readable Stream object to the Body payload:

// Read the body from a stream
var writeParams = {Bucket:'bucket',Key:'image.jpg',Body:stream};
var stream = fs.createReadStream('/path/to/image.jpg');
s3.client.putObject(writeParams, function() {
  // Write the body Buffer object to a file
  var readParams = {Bucket:'bucket',Key:'image.jpg'};
  s3.client.getObject(readParams, function(err, data) {
    var out = fs.createWriteStream('/path/to/image2.jpg');
    out.write(data.Body);
    out.end();
  });
});
Error Objects

The SDK for Node.js will now return and throw proper Error objects in callbacks:

s3.listBuckets(function(err, data) {
  if (err) {
    console.log(err); // err is an Error object;
  }
});

Resolved Issues

Change Description
Various AWS.S3 Fixes

Added missing headers for PUT, GET and HEAD (and other) object operations. Fixed a number of S3 operations with incorrect input nesting.

Date Off-By-One Error

Resolve issue where XML parsing was causing off-by-one errors in Javascript dates.

EC2.Client.runInstances

Resolves an issue where some Amazon EC2 service calls were returning only a single element in the response.

URI Escaping with UTF-8

Resolves an issue where AWS.util.uriEscape was incorrectly encoding utf8 characters.

Credential and Region Validation

Add validations for services that require credentials and validations. If credentials or validations are not provided, an appropriate error will be raised by the request.

Supported API Versions

This release of the SDK supports the following API versions:

Service API Version
Amazon DynamoDB 2011-12-05
Amazon Elastic Compute Cloud 2012-12-01
Amazon Elastic Transcoder 2012-09-25
Amazon Simple E-mail Service 2010-12-01
Amazon Simple Queue Service 2011-10-01
Amazon Simple Storage Service 2006-03-01
Amazon Simple Workflow Service 2012-01-25