AWS SDK for JavaScript - Developer Guide for SDK v2
Developer Guide for SDK v2
AWS SDK for JavaScript
Copyright ? 2024 Amazon Web Services, Inc. and/or its a?liates. All rights reserved.
AWS SDK for JavaScript
Developer Guide for SDK v2
AWS SDK for JavaScript: Developer Guide for SDK v2
Copyright ? 2024 Amazon Web Services, Inc. and/or its a?liates. All rights reserved.
Amazon's trademarks and trade dress may not be used in connection with any product or service
that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any
manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are
the property of their respective owners, who may or may not be a?liated with, connected to, or
sponsored by Amazon.
AWS SDK for JavaScript
Developer Guide for SDK v2
Table of Contents
......................................................................................................................................................... ix
What Is the AWS SDK for JavaScript? ............................................................................................ 1
Maintenance and support for SDK major versions ................................................................................ 1
Using the SDK with Node.js ....................................................................................................................... 2
Using the SDK with AWS Cloud9 .............................................................................................................. 2
Using the SDK with AWS Amplify ............................................................................................................
Using the SDK with Web Browsers ...........................................................................................................
Common Use Cases ................................................................................................................................
About the Examples ...............................................................................................................................
2
2
3
3
Getting Started ................................................................................................................................ 4
Getting Started in a Browser Script ......................................................................................................... 4
The Scenario ............................................................................................................................................. 4
Step 1: Create an Amazon Cognito Identity Pool ............................................................................ 5
Step 2: Add a Policy to the Created IAM Role .................................................................................. 6
Step 3: Create the HTML Page ............................................................................................................. 7
Step 4: Write the Browser Script ......................................................................................................... 8
Step 5: Run the Sample ........................................................................................................................ 9
Full Sample ............................................................................................................................................ 10
Possible Enhancements ....................................................................................................................... 11
Getting Started in Node.js ....................................................................................................................... 12
The Scenario .......................................................................................................................................... 12
Prerequisite Tasks ................................................................................................................................. 12
Step 1: Install the SDK and Dependencies ...................................................................................... 13
Step 2: Con?gure Your Credentials ................................................................................................... 13
Step 3: Create the Package JSON for the Project .......................................................................... 14
Step 4: Write the Node.js Code ......................................................................................................... 15
Step 5: Run the Sample ...................................................................................................................... 16
Using AWS Cloud9 with the SDK for JavaScript .......................................................................... 17
Step 1: Set up Your AWS Account to Use AWS Cloud9 ...................................................................... 17
Step 2: Set up Your AWS Cloud9 Development Environment .......................................................... 17
Step 3: Set up the SDK for JavaScript .................................................................................................. 18
To set up the SDK for JavaScript for Node.js ................................................................................. 18
To set up the SDK for JavaScript in the browser ........................................................................... 19
Step 4: Download Example Code ........................................................................................................... 19
iii
AWS SDK for JavaScript
Developer Guide for SDK v2
Step 5: Run and Debug Example Code ................................................................................................. 19
Setting Up the SDK for JavaScript ............................................................................................... 20
Prerequisites ................................................................................................................................................ 20
Setting Up an AWS Node.js Environment ........................................................................................ 20
Web Browsers Supported .................................................................................................................... 21
Installing the SDK ...................................................................................................................................... 22
Installing Using Bower ......................................................................................................................... 23
Loading the SDK ........................................................................................................................................
Upgrading From Version 1 .......................................................................................................................
Automatic Conversion of Base64 and Timestamp Types on Input/Output ..............................
Moved response.data.RequestId to response.requestId ................................................................
23
24
24
25
Exposed Wrapper Elements ................................................................................................................ 26
Dropped Client Properties .................................................................................................................. 31
Con?guring the SDK for JavaScript ............................................................................................. 32
Using the Global Con?guration Object ................................................................................................. 32
Setting Global Con?guration ............................................................................................................. 33
Setting Con?guration Per Service ..................................................................................................... 35
Immutable Con?guration Data .......................................................................................................... 35
Setting the AWS Region ........................................................................................................................... 35
In a Client Class Constructor .............................................................................................................. 36
Using the Global Con?guration Object ............................................................................................ 36
Using an Environment Variable ......................................................................................................... 36
Using a Shared Con?g File ................................................................................................................. 36
Order of Precedence for Setting the Region .................................................................................. 37
Specifying Custom Endpoints .................................................................................................................. 37
Endpoint String Format ....................................................................................................................... 37
Endpoints for the ap-northeast-3 Region ....................................................................................... 38
Endpoints for MediaConvert .............................................................................................................. 38
SDK authentication with AWS ................................................................................................................. 38
Start an AWS access portal session .................................................................................................. 40
More authentication information ...................................................................................................... 40
Setting Credentials .................................................................................................................................... 41
Best Practices for Credentials ............................................................................................................ 41
Setting Credentials in Node.js ............................................................................................................ 42
Setting Credentials in a Web Browser .............................................................................................. 47
Locking API Versions ................................................................................................................................. 57
iv
AWS SDK for JavaScript
Developer Guide for SDK v2
Getting API Versions ............................................................................................................................ 57
Node.js Considerations .............................................................................................................................. 58
Using Built-In Node.js Modules .......................................................................................................... 58
Using NPM Packages ............................................................................................................................ 58
Con?guring maxSockets in Node.js .................................................................................................. 59
Reusing Connections with Keep-Alive in Node.js ........................................................................... 60
Con?guring Proxies for Node.js ......................................................................................................... 61
Registering Certi?cate Bundles in Node.js ...................................................................................... 62
Browser Script Considerations ................................................................................................................. 62
Building the SDK for Browsers .......................................................................................................... 63
Cross-Origin Resource Sharing (CORS) ............................................................................................. 66
Bundling with Webpack ............................................................................................................................ 70
Installing Webpack ............................................................................................................................... 70
Con?guring Webpack ........................................................................................................................... 71
Running Webpack ................................................................................................................................. 72
Using the Webpack Bundle ................................................................................................................ 73
Importing Individual Services ............................................................................................................. 73
Bundling for Node.js ............................................................................................................................ 74
Working with Services .................................................................................................................. 76
Creating and Calling Service Objects ..................................................................................................... 77
Requiring Individual Services ............................................................................................................. 78
Creating Service Objects ..................................................................................................................... 79
Locking the API Version of a Service Object .................................................................................. 80
Specifying Service Object Parameters ............................................................................................. 80
Logging AWS SDK for JavaScript Calls .................................................................................................. 81
Using a Third-Party Logger ................................................................................................................ 81
Calling Services Asychronously ............................................................................................................... 82
Managing Asychronous Calls .............................................................................................................. 82
Using a Callback Function .................................................................................................................. 83
Using a Request Object Event Listener ............................................................................................ 85
Using async/await ................................................................................................................................. 90
Using Promises ...................................................................................................................................... 91
Using the Response Object ...................................................................................................................... 93
Accessing Data Returned in the Response Object ......................................................................... 93
Paging Through Returned Data ......................................................................................................... 94
Accessing Error Information from a Response Object .................................................................. 95
v
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- simple obfuscated file transfer soft developers guide
- file upload restrictions bypass exploit database
- developing secure java code best practices for a team
- file uploads and cookies
- understanding file upload security for web applications
- uploading in
- creating a file upload form
- http and client side form handling
- aws sdk for javascript developer guide for sdk v2
- multiple upload dengan jumlah dinamis menggunakan
Related searches
- excel guide for beginners pdf
- minecraft guide for beginners
- nature guide for authors
- study guide for philosophy 101
- study guide for photosynthesis pdf
- nature journal guide for authors
- payroll limitation guide for owners and officers
- nature methods guide for author
- retirement guide for dummies
- investing guide for beginners
- interview guide for research study
- fashion style guide for women