AWS SDK for JavaScript
Developer Guide for SDK v2

Creating a Glacier Vault

JavaScript code example that applies to Node.js execution

This Node.js code example shows:

  • How to create a vault using the createVault method of the Amazon S3 Glacier service object.

Prerequisite Tasks

To set up and run this example, you must first complete these tasks:

Configuring the SDK

Configure the SDK for JavaScript by creating a global configuration object then setting the region for your code. In this example, the region is set to us-west-2.

// Load the SDK for JavaScript var AWS = require('aws-sdk'); // Set the region AWS.config.update({region: 'us-west-2'});

Create the Vault

// Load the SDK for JavaScript var AWS = require('aws-sdk'); // Set the region AWS.config.update({region: 'REGION'}); // Create a new service object var glacier = new AWS.Glacier({apiVersion: '2012-06-01'}); // Call Glacier to create the vault glacier.createVault({vaultName: 'YOUR_VAULT_NAME'}, function(err) { if (!err) { console.log("Created vault!") } });