Menu
AWS SDK for JavaScript
Developer Guide for SDK version 2.122.0

Getting Started in Node.js


                                        Relationship between JavaScript environments, the SDK, and Lambda

This example consists of a Node.js package that:

  • Creates an Amazon Simple Storage Service (Amazon S3) service object.

  • Creates an Amazon S3 bucket.

  • Uploads an object to the created bucket.

For more information on Node.js packages, see Packages and Modules at the npm (the Node.js package manager) website. For information about downloading and installing the AWS SDK for JavaScript, see Installing the SDK for JavaScript.

Step 1: Downloading the Sample Project

You can download the sample package from GitHub with the following command. You must have Git installed.

Copy
git clone https://github.com/awslabs/aws-nodejs-sample.git

Step 2: Installing the SDK and Dependencies

You install the SDK for JavaScript package using the npm (the Node.js package manager). From the aws-nodejs-sample directory in the package, type the following at the command line.

Copy
npm install

Step 3: Configuring the Access Keys

Create your credentials file at ~/.aws/credentials (C:\Users\USER_NAME\.aws\credentials for Windows users) and then add the following lines. Replace YOUR_ACCESS_KEY_ID and YOUR_SECRET_ACCESS_KEY with the actual values from your account. For more information about how to obtain your credentials, see Getting Your Credentials.

Copy
[default] aws_access_key_id = YOUR_ACCESS_KEY_ID aws_secret_access_key = YOUR_SECRET_ACCESS_KEY

Step 4: Running the Sample

Type the following command to run the sample.

node sample.js