Getting Started with AWS JavaScript SDK

AWS provides JavaScript SDK for Node.js or Browsers which can allow interaction with Amazon Web services through Java Script developments. The JavaScript APIs which are available in the SDK allow developers to build libraries or applications that make use of AWS services.

Using the AWS SDK for Node.js developments

Node.js is one of the major cross-platform run-time for running server-side JavaScript applications. So here you need to configure your environment for Node.js before working with AWS SDK. You can follow this tutorial to install Node.js for your environment.

Now we are moving to create the first JavaScript App which can interact with AWS!

First Development
  • There is a sample project in the GitHub, So you can simply clone to your system. You must have Git installed to get this project from GitHub.

If you clone the project, then You can see the following line in the sample.js file.

// Load the SDK and UUID
var AWS = require(‘aws-sdk’);
var uuid = require(‘node-uuid’);

  • It means, the JS files requires those dependencies for the development. So you need to run npm installcommand to install those required dependencies including AWS SDK.
  • Now you want to configure your environment with AWS. To configure the AWS credentials, Create a credentials file at ~/.aws/credentialson Mac/Linux or C:\Users\USERNAME\.aws\credentials on Windows

In Linux, You want to go to your Home directory and press Ctrl+H to get the view of hidden folders. Then after creating a directory as .aws and then create a credentials file inside the folder.
Create credentials file using the following lines,

aws_access_key_id = your_access_key
aws_secret_access_key = your_secret_key

How to get AWS Access Key and Secret Key?

If you haven’t Amazon Access Key and Secret Key already, then follow these ways to get it,

  • Go to your AWA Console and then Search Identity and Access Management under Services and Click to enter IAM. In the IAM Dashboard, you can see this following menus,
  • Click on the first menu(Delete your root access keys) and then click Manage Security Credentials to get your keys.
  • Then after you will be redirected to Security Credentials management dashboard. At there, Click access Keys(Access Key ID and Secret Access Key menu). Now you can see Create New Access Key button.
  • Click Create New Access Key button to get your Access Keys. If you click Show Access key there, then you will get your Access Key and Secret Access Keys.

Run your First Application

Now you are almost ready to run your first JavaScript application with AWS. So just type node sample.js command to execute the code file. If you configured and manged all the dependencies correctly, then most properly you will get a success message like this,

Finally, If you check your Amazon S3 account, then you can see there was a new bucket created and the hello_world.txt file was uploaded inside that bucket.

Help from


Leave a Reply

Your email address will not be published. Required fields are marked *