EasyManuals Logo

Amazon AWS SDK User Manual

Amazon AWS SDK
19 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #13 background imageLoading...
Page #13 background image
Making Requests
Asynchronous Callbacks
All requests made through the SDK are asynchronous and use a callback interface. Each service method
that kicks off a request can accept a callback as the last parameter with the signature function(error,
data) { ... }.This callback will be called when the response or error data is available.
For example, the following service method can be called with a standard callback to retrieve the response
data or error:
new AWS.EC2().client.describeInstances(function(error, data) {
if (error) {
console.log(error); // an error occurred
} else {
console.log(data); // request succeeded
}
});
The error and data parameters are described in the Response Object section below.
Note that if you do not specify a callback, the operation will return an AWS.Request object that must be
manually sent using the send() method:
// create the AWS.Request object
var request = new AWS.EC2().client.describeInstances();
// register a callback to report on the data
request.on('success', function(resp) {
console.log(response.data); // log the successful data response
});
// send the request
request.send();
Version 0.9.1-pre.2 : Preview
9
AWS SDK for Node.js Getting Started Guide
Asynchronous Callbacks

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Amazon AWS SDK and is the answer not in the manual?

Amazon AWS SDK Specifications

General IconGeneral
CategorySoftware Development Kit (SDK)
DeveloperAmazon Web Services (AWS)
LicenseApache License 2.0
PurposeTo enable developers to interact with AWS services from their applications.
Supported LanguagesJava, Python, JavaScript, .NET, Ruby, PHP, Go, C++
Supported AWS ServicesAll AWS services
Operating SystemsWindows, macOS, Linux
Latest VersionVaries by SDK and language. Refer to the official AWS documentation for the specific SDK.
RepositoryGitHub (for many SDKs)
DocumentationAvailable on the AWS website.
SDK FeaturesAPI abstraction, request signing, error handling, retry logic, data serialization, and support for various authentication methods.

Related product manuals