---
title: "AWS SDK for JavaScript With Wasabi"
slug: "how-do-i-use-aws-sdk-for-javascript-with-wasabi"
updated: 2026-05-28T15:57:50Z
published: 2026-05-28T15:57:50Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wasabi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS SDK for JavaScript With Wasabi

[AWS SDK for JavaScript](https://github.com/aws/aws-sdk-js) v2 has been certified for use with Wasabi. Wasabi uses this SDK to help power the [Wasabi Management Console](https://console.wasabisys.com/).

To use the Javascript SDK, execute the following steps.

1. Install the [AWS SDK for Javascript using npm](https://aws.amazon.com/sdk-for-javascript/).
2. Configure an additional [AWS CLI profile for Wasabi](https://docs.wasabi.com/docs/how-do-i-use-aws-cli-with-wasabi) account using the Wasabi keys (optional).

In this example, we have set the profile name as "wasabi" in the "~/.aws/credentials" file. To help our customers use this SDK with Wasabi, we have provided examples for both IAM and S3. For rther examples, refer to the [AWS documentation](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/).

> [!NOTE]
> This example discusses the use of Wasabi's us-east-1 storage region. To use other Wasabi storage regions, use the appropriate Wasabi service URL as described in [Service URLs for Wasabi's Storage Regions](https://docs.wasabi.com/docs/what-are-the-service-urls-for-wasabis-different-storage-regions)**.**

> [!NOTE]
> Send all IAM requests to [iam.wasabisys.com](http://iam.wasabisys.com).

## Setting the Credentials

```plaintext
// Load the SDK
const AWS = require('aws-sdk');

// Connection
// This is how you can use the .aws credentials file to fetch the credentials
const credentials = new AWS.SharedIniFileCredentials({profile: 'wasabi'});
AWS.config.credentials = credentials;

// This is a configuration to directly use a profile from aws credentials file.
// AWS.config.credentials.accessKeyId = ""
// AWS.config.credentials.secretAccessKey = ""

// Set the AWS region. us-east-1 is the default for IAM calls.
AWS.config.region = "us-east-1";
```

## Connecting to IAM and S3 Endpoints

### IAM

```plaintext
// Load the SDK
const AWS = require('aws-sdk');

// Connection
// This is how you can use the .aws credentials file to fetch the credentials
const credentials = new AWS.SharedIniFileCredentials({profile: 'wasabi'});
AWS.config.credentials = credentials;

// This is a configuration to directly use a profile from aws credentials file.
// AWS.config.credentials.accessKeyId = ""
// AWS.config.credentials.secretAccessKey = ""

// Set the AWS region. us-east-1 is default for IAM calls.
AWS.config.region = "us-east-1";

// Set an endpoint. For IAM us-east-1 or s3.wasabisys.com is what you need.
const ep = new AWS.Endpoint('iam.wasabisys.com');

// Create an IAM client
const iam = new AWS.S3({endpoint: ep});
```

### S3

```plaintext
// Load the SDK
const AWS = require('aws-sdk');

// Connection
// This is how you can use the .aws credentials file to fetch the credentials
const credentials = new AWS.SharedIniFileCredentials({profile: 'wasabi'});
AWS.config.credentials = credentials;

// This is a configuration to directly use a profile from aws credentials file.
// AWS.config.credentials.accessKeyId = ""
// AWS.config.credentials.secretAccessKey = ""

// Set the AWS region.
AWS.config.region = "us-east-1";

// Set an endpoint. 

const ep = new AWS.Endpoint('s3.wasabisys.com');

// Create an S3 client
const s3 = new AWS.S3({endpoint: ep});
```

## Creating a User Using IAM

```plaintext
// Load the SDK
const AWS = require('aws-sdk');

// Connection
// This is how you can use the .aws credentials file to fetch the credentials
const credentials = new AWS.SharedIniFileCredentials({profile: 'wasabi'});
AWS.config.credentials = credentials;

// This is a configuration to directly use a profile from aws credentials file.
// AWS.config.credentials.accessKeyId = ""
// AWS.config.credentials.secretAccessKey = ""

// Set the AWS region. us-east-1 is default for IAM calls.
AWS.config.region = "us-east-1";

// Set an endpoint. For IAM us-east-1 or s3.wasabisys.com is what you need.
const ep = new AWS.Endpoint('iam.wasabisys.com');

// Create an IAM client
const iam = new AWS.IAM({endpoint:ep});

// here is an example of creating a user using IAM
const user_params = {
    UserName: "BOB"
};

iam.createUser(user_params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
});
```

## Creating a Bucket

```plaintext
// Load the SDK
const AWS = require('aws-sdk');

// Connection
// This is how you can use the .aws credentials file to fetch the credentials
const credentials = new AWS.SharedIniFileCredentials({profile: 'wasabi'});
AWS.config.credentials = credentials;

// This is a configuration to directly use a profile from aws credentials file.
// AWS.config.credentials.accessKeyId = ""
// AWS.config.credentials.secretAccessKey = ""

// Set the AWS region. us-east-1 is default for IAM calls.
AWS.config.region = "us-east-1";

// Set an endpoint.
const ep = new AWS.Endpoint('s3.wasabisys.com');

// Create an S3 client
const s3 = new AWS.S3({endpoint: ep});

// The following example creates a bucket.
// set the parameters
const bucket_params = {
    Bucket: "bucket-name"
};

// create a bucket with the above parameters.
s3.createBucket(bucket_params, function (err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else console.log(data);           // successful response
});
```

## Uploading an Object to the Bucket

```plaintext
// Load the SDK
const AWS = require('aws-sdk');

// Connection
// This is how you can use the .aws credentials file to fetch the credentials
const credentials = new AWS.SharedIniFileCredentials({profile: 'wasabi'});
AWS.config.credentials = credentials;

// This is a configuration to directly use a profile from aws credentials file.
// AWS.config.credentials.accessKeyId = ""
// AWS.config.credentials.secretAccessKey = ""

// Set the AWS region. us-east-1 is default for IAM calls.
AWS.config.region = "us-east-1";

// Set an endpoint.
const ep = new AWS.Endpoint('s3.wasabisys.com');

// Create an S3 client
const s3 = new AWS.S3({endpoint: ep});

// The following example creates an object. If the bucket is versioning enabled, S3 returns version ID in response.
// set key and bucket.
const object_upload_params = {
    Bucket: "bucket-name",
    Key: "file-name"
};

// upload object to previously created "examplebucket"
s3.putObject(object_upload_params, function (err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else console.log(data);           // successful response
});
```

## Reading an Object From the Bucket

```plaintext
// Load the SDK
const AWS = require('aws-sdk');

// Connection
// This is how you can use the .aws credentials file to fetch the credentials
const credentials = new AWS.SharedIniFileCredentials({profile: 'wasabi'});
AWS.config.credentials = credentials;

// This is a configuration to directly use a profile from aws credentials file.
// AWS.config.credentials.accessKeyId = ""
// AWS.config.credentials.secretAccessKey = ""

// Set the AWS region. us-east-1 is default for IAM calls.
AWS.config.region = "us-east-1";

// Set an endpoint.
const ep = new AWS.Endpoint('s3.wasabisys.com');

// Create an S3 client
const s3 = new AWS.S3({endpoint: ep});

// The following example retrieves an object for an S3 bucket.
// set the details for the bucket and key
const object_get_params = {
    Bucket: "bucket-name",
    Key: "file-name"
};

// get the object that we just uploaded.
// get the uploaded test_file
s3.getObject(object_get_params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
});
```

## Deleting the Object From the Bucket

```plaintext
// Load the SDK
const AWS = require('aws-sdk');

// Connection
// This is how you can use the .aws credentials file to fetch the credentials
const credentials = new AWS.SharedIniFileCredentials({profile: 'wasabi'});
AWS.config.credentials = credentials;

// This is a configuration to directly use a profile from aws credentials file.
// AWS.config.credentials.accessKeyId = ""
// AWS.config.credentials.secretAccessKey = ""

// Set the AWS region. us-east-1 is default for IAM calls.
AWS.config.region = "us-east-1";

// Set an endpoint.
const ep = new AWS.Endpoint('s3.wasabisys.com');

// Create an S3 client
const s3 = new AWS.S3({endpoint: ep});

// The following example deletes an object from a non-versioned bucket.
const delete_params = {
    Bucket: "bucket-name",
    Key: "file-name"
};
s3.deleteObject(delete_params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
});
```
