Menu
AWS SDK for JavaScript
Developer Guide for SDK v2.154.0

Creating an Amazon 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 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.

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

Create the Vault

Copy
// Load the SDK for JavaScript var AWS = require('aws-sdk'); // Set the region AWS.config.update({region: 'us-west-2'}); var glacier = new AWS.Glacier({apiVersion: '2012-06-01'}); glacier.createVault({vaultName: 'YOUR_VAULT_NAME'}, function(err) { if (!err) console.log("Created vault!") });