Quickstart - AWS SDK and Hosted Gateway MT

Hosted S3 Compatible Multitenant Gateway - AWS SDK

Storj now offers a hosted multitenant gateway (Gateway MT) that is backward compatible with S3. This means you’ll be able to integrate with the Storj network via HTTP, and you won’t have to run anything extra on your end.

By using hosted Gateway MT you are opting-in to server-side encryption.

Using Gateway MT with AWS SDK is a 2-step process:

Generate Credentials to the Gateway MT

Navigate to the Access page within your project and then click on Create Access Grant +. A modal window will pop up where you can enter a name for this access grant.

Assign the permissions you want this access grant to have, then click on Continue in Browser:

Enter the Encryption Passphrase you used for your other access grants. If this is your first access grant, we strongly encourage you to use a mnemonic phrase as your encryption passphrase (The GUI automatically generates one on the client-side for you.)

Click on the Generate S3 Gateway Credentials link and then click on the Generate Credentials button.

Copy your Access Key, Secret Key, and Endpoint to a safe location for future use.

Now you are ready to configure AWS SDK

Gateway MT with Amazon S3 SDK (Node.js)

1. Install or include the Amazon S3 SDK

e.g. with npm

npm install --save aws-sdk

2. Import the S3 client

import S3 from "aws-sdk/clients/s3";

3. Create client object with MT credentials

const accessKeyId = "access key here";
const secretAccessKey = "secret access key here";
const endpoint = "https://gateway.tardigradeshare.io";
const s3 = new S3({
s3ForcePathStyle: true,
signatureVersion: "v4",
connectTimeout: 0,
httpOptions: { timeout: 0 }

4. List objects and log to console

(async () => {
const { Buckets } = await s3.listBuckets({}).promise();

5. Upload an object

(async () => {
// `file` can be a readable stream in node or a `Blob` in the browser
const params = {
Bucket: "my-bucket",
Key: "my-object",
Body: file
await s3.upload(params, {
partSize: 64 * 1024 * 1024

6. Get URL that points to an object

The getSignedUrl function creates a cryptographically signed url. No contact with the gateway is needed here; this happens instantaneously.

const params = {
Bucket: "my-bucket",
Key: "my-object"
const url = s3.getSignedUrl("getObject", params);
// e.g. create an <img> where src points to url