What's the Amazon SDK for JavaScript? - Amazon SDK for JavaScript
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

The Amazon SDK for JavaScript V3 API Reference Guide describes in detail all the API operations for the Amazon SDK for JavaScript version 3 (V3).

What's the Amazon SDK for JavaScript?

Welcome to the Amazon SDK for JavaScript Developer Guide. This guide provides general information about setting up and configuring the Amazon SDK for JavaScript. It also walks you through examples and tutorial of running various Amazon services using the Amazon SDK for JavaScript.

The Amazon SDK for JavaScript v3 API Reference Guide provides a JavaScript API for Amazon services. You can use the JavaScript API to build libraries or applications for Node.js or the browser.

Relationship between JavaScript environments, the SDK, and Amazon Web Services

Get started with the SDK

If you’re ready to get hands-on with the SDK, follow the examples at Get started with the Amazon SDK for JavaScript.

To set up your development environment, see Set up the SDK for JavaScript.

If you’re currently using version 2.x of SDK for JavaScript, see Migrate to v3 for specific guidance.

If you’re looking for code examples for Amazon Web Services services, see SDK for JavaScript (v3) code examples.

Maintenance and support for SDK major versions

For information about maintenance and support for SDK major versions and their underlying dependencies, see the following in the Amazon SDKs and Tools Reference Guide:

Using the SDK with Node.js

Node.js is a cross-platform runtime for running server-side JavaScript applications. You can set up Node.js on an Amazon Elastic Compute Cloud (Amazon EC2) instance to run on a server. You can also use Node.js to write on-demand Amazon Lambda functions.

Using the SDK for Node.js differs from the way in which you use it for JavaScript in a web browser. The difference comes from the way in which you load the SDK and in how you obtain the credentials needed to access specific web services. When use of particular APIs differs between Node.js and the browser, we call out those differences.

Using the SDK with Amazon Amplify

For browser-based web, mobile, and hybrid apps, you can also use the Amazon Amplify library on GitHub. It extends the SDK for JavaScript, providing a declarative interface.

Note

Frameworks such as Amplify might not offer the same browser support as the SDK for JavaScript. See the framework's documentation for details.

Using the SDK with web browsers

All major web browsers support execution of JavaScript. JavaScript code that is running in a web browser is often called client-side JavaScript.

For a list of browsers that are supported by the Amazon SDK for JavaScript, see Supported web browsers.

Using the SDK for JavaScript in a web browser differs from the way in which you use it for Node.js. The difference comes from the way in which you load the SDK and in how you obtain the credentials needed to access specific web services. When use of particular APIs differs between Node.js and the browser, we call out those differences.

Using browsers in V3

V3 enables you to bundle and include in the browser only the SDK for JavaScript files you require, reducing overhead.

To use V3 of the SDK for JavaScript in your HTML pages, you must bundle the required client modules and all required JavaScript functions into a single JavaScript file using Webpack, and add it in a script tag in the <head> of your HTML pages. For example:

<script src="./main.js"></script>
Note

For more information about Webpack, see Bundle applications with webpack.

To use V2 of the SDK for JavaScript, you add a script tag that points to the latest version of the V2 SDK instead. For more information, see the sample in the Amazon SDK for JavaScript Developer Guide v2.

Common use cases

Using the SDK for JavaScript in browser scripts makes it possible to realize a number of compelling use cases. Here are several ideas for things you can build in a browser application by using the SDK for JavaScript to access various web services.

  • Build a custom console to Amazon services in which you access and combine features across Regions and services to best meet your organizational or project needs.

  • Use Amazon Cognito Identity to enable authenticated user access to your browser applications and websites, including use of third-party authentication from Facebook and others.

  • Use Amazon Kinesis to process click streams or other marketing data in real time.

  • Use Amazon DynamoDB for serverless data persistence, such as individual user preferences for website visitors or application users.

  • Use Amazon Lambda to encapsulate proprietary logic that you can invoke from browser scripts without downloading and revealing your intellectual property to users.

About the examples

You can browse the SDK for JavaScript examples in the Amazon Code Example Repository.

Resources

In addition to this guide, the following online resources are available for SDK for JavaScript developers: