

 **This page is only for existing customers of the Amazon Glacier service using Vaults and the original REST API from 2012.**

If you're looking for archival storage solutions, we recommend using the Amazon Glacier storage classes in Amazon S3, S3 Glacier Instant Retrieval, S3 Glacier Flexible Retrieval, and S3 Glacier Deep Archive. To learn more about these storage options, see [Amazon Glacier storage classes](https://aws.amazon.com/s3/storage-classes/glacier/).

Amazon Glacier (original standalone vault-based service) is no longer accepting new customers. Amazon Glacier is a standalone service with its own APIs that stores data in vaults and is distinct from Amazon S3 and the Amazon S3 Glacier storage classes. Your existing data will remain secure and accessible in Amazon Glacier indefinitely. No migration is required. For low-cost, long-term archival storage, AWS recommends the [Amazon S3 Glacier storage classes](https://aws.amazon.com/s3/storage-classes/glacier/), which deliver a superior customer experience with S3 bucket-based APIs, full AWS Region availability, lower costs, and AWS service integration. If you want enhanced capabilities, consider migrating to Amazon S3 Glacier storage classes by using our [AWS Solutions Guidance for transferring data from Amazon Glacier vaults to Amazon S3 Glacier storage classes](https://aws.amazon.com/solutions/guidance/data-transfer-from-amazon-s3-glacier-vaults-to-amazon-s3/).

# Creating a Vault in Amazon Glacier
<a name="creating-vaults"></a>

Creating a vault adds a vault to the set of vaults in your account. An AWS account can create up to 1,000 vaults per AWS Region. For a list of the AWS Regions supported by Amazon Glacier (Amazon Glacier), see [Regions and Endpoints](https://docs.aws.amazon.com/general/latest/gr/rande.html#glacier_region) in the *AWS General Reference*.

When you create a vault, you must provide a vault name. The following are the vault naming requirements: 

 
+  Names can be between 1 and 255 characters long. 
+ Allowed characters are a–z, A–Z, 0–9, '\$1' (underscore), '-' (hyphen), and '.' (period).

Vault names must be unique within an account and the AWS Region in which the vault is being created. That is, an account can create vaults with the same name in different AWS Regions but not in the same AWS Region. 

**Topics**
+ [Creating a Vault in Amazon Glacier Using the AWS SDK for Java](creating-vaults-sdk-java.md)
+ [Creating a Vault in Amazon Glacier Using the AWS SDK for .NET](creating-vaults-dotnet-sdk.md)
+ [Creating a Vault in Amazon Glacier Using the REST API](creating-vaults-rest-api.md)
+ [Creating a Vault Using the Amazon Glacier Console](creating-vaults-console.md)
+ [Creating a Vault in Amazon Glacier Using the AWS Command Line Interface](creating-vaults-cli.md)

# Creating a Vault in Amazon Glacier Using the AWS SDK for Java
<a name="creating-vaults-sdk-java"></a>

The low-level API provides methods for all the vault operations, including creating and deleting vaults, getting a vault description, and getting a list of vaults created in a specific AWS Region. The following are the steps to create a vault using the AWS SDK for Java. 

 

1. Create an instance of the `AmazonGlacierClient` class (the client). 

   You need to specify an AWS Region in which you want to create a vault. All operations you perform using this client apply to that AWS Region.

1. Provide request information by creating an instance of the `CreateVaultRequest` class.

   Amazon Glacier (Amazon Glacier) requires you to provide a vault name and your account ID. If you don't provide an account ID, then the account ID associated with the credentials you provide to sign the request is used. For more information, see [Using the AWS SDK for Java with Amazon Glacier](using-aws-sdk-for-java.md). 

1. Run the `createVault` method by providing the request object as a parameter. 

   The response Amazon Glacier returns is available in the `CreateVaultResult` object.

The following Java code snippet illustrates the preceding steps. The snippet creates a vault in the `us-west-2` Region. The `Location` it prints is the relative URI of the vault that includes your account ID, the AWS Region, and the vault name.

```
AmazonGlacierClient client = new AmazonGlacierClient(credentials);
client.setEndpoint("https://glacier.us-west-2.amazonaws.com");

CreateVaultRequest request = new CreateVaultRequest()
    .withVaultName("*** provide vault name ***");
CreateVaultResult result = client.createVault(request);

System.out.println("Created vault successfully: " + result.getLocation());
```

**Note**  
For information about the underlying REST API, see [Create Vault (PUT vault)](api-vault-put.md). 

## Example: Creating a Vault Using the AWS SDK for Java
<a name="creating-vaults-sdk-java-example"></a>

The following Java code example creates a vault in the `us-west-2` Region (for more information on AWS Regions, see [Accessing Amazon Glacier](amazon-glacier-accessing.md)). In addition, the code example retrieves the vault information, lists all vaults in the same AWS Region, and then deletes the vault created. 

For step-by-step instructions on how to run the following example, see [Running Java Examples for Amazon Glacier Using Eclipse](using-aws-sdk-for-java.md#setting-up-and-testing-sdk-java). 

**Example**  

```
import java.io.IOException;
import java.util.List;

import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.glacier.AmazonGlacierClient;
import com.amazonaws.services.glacier.model.CreateVaultRequest;
import com.amazonaws.services.glacier.model.CreateVaultResult;
import com.amazonaws.services.glacier.model.DeleteVaultRequest;
import com.amazonaws.services.glacier.model.DescribeVaultOutput;
import com.amazonaws.services.glacier.model.DescribeVaultRequest;
import com.amazonaws.services.glacier.model.DescribeVaultResult;
import com.amazonaws.services.glacier.model.ListVaultsRequest;
import com.amazonaws.services.glacier.model.ListVaultsResult;


public class AmazonGlacierVaultOperations {

    public static AmazonGlacierClient client;

    public static void main(String[] args) throws IOException {

    	ProfileCredentialsProvider credentials = new ProfileCredentialsProvider();
    	
        client = new AmazonGlacierClient(credentials);
        client.setEndpoint("https://glacier.us-east-1.amazonaws.com/");
        
        String vaultName = "examplevaultfordelete";

        try {            
            createVault(client, vaultName);
            describeVault(client, vaultName); 
            listVaults(client);
            deleteVault(client, vaultName);      

        } catch (Exception e) {
            System.err.println("Vault operation failed." + e.getMessage());
        }
    }

    private static void createVault(AmazonGlacierClient client, String vaultName) {
        CreateVaultRequest createVaultRequest = new CreateVaultRequest()
            .withVaultName(vaultName);
        CreateVaultResult createVaultResult = client.createVault(createVaultRequest);

        System.out.println("Created vault successfully: " + createVaultResult.getLocation());
    }

    private static void describeVault(AmazonGlacierClient client, String vaultName) {
        DescribeVaultRequest describeVaultRequest = new DescribeVaultRequest()
            .withVaultName(vaultName);
        DescribeVaultResult describeVaultResult  = client.describeVault(describeVaultRequest);

        System.out.println("Describing the vault: " + vaultName);
        System.out.print(
                "CreationDate: " + describeVaultResult.getCreationDate() +
                "\nLastInventoryDate: " + describeVaultResult.getLastInventoryDate() +
                "\nNumberOfArchives: " + describeVaultResult.getNumberOfArchives() + 
                "\nSizeInBytes: " + describeVaultResult.getSizeInBytes() + 
                "\nVaultARN: " + describeVaultResult.getVaultARN() + 
                "\nVaultName: " + describeVaultResult.getVaultName());
    }

    private static void listVaults(AmazonGlacierClient client) {
        ListVaultsRequest listVaultsRequest = new ListVaultsRequest();
        ListVaultsResult listVaultsResult = client.listVaults(listVaultsRequest);

        List<DescribeVaultOutput> vaultList = listVaultsResult.getVaultList();
        System.out.println("\nDescribing all vaults (vault list):");
        for (DescribeVaultOutput vault : vaultList) {
            System.out.println(
                    "\nCreationDate: " + vault.getCreationDate() +
                    "\nLastInventoryDate: " + vault.getLastInventoryDate() +
                    "\nNumberOfArchives: " + vault.getNumberOfArchives() + 
                    "\nSizeInBytes: " + vault.getSizeInBytes() + 
                    "\nVaultARN: " + vault.getVaultARN() + 
                    "\nVaultName: " + vault.getVaultName()); 
        }
    }

    private static void deleteVault(AmazonGlacierClient client, String vaultName) {
        DeleteVaultRequest request = new DeleteVaultRequest()
            .withVaultName(vaultName);
        client.deleteVault(request);
        System.out.println("Deleted vault: " + vaultName);
    }

}
```

# Creating a Vault in Amazon Glacier Using the AWS SDK for .NET
<a name="creating-vaults-dotnet-sdk"></a>

Both the [high-level and low-level APIs](using-aws-sdk.md) provided by the Amazon SDK for .NET provide a method to create a vault.

**Topics**
+ [Creating a Vault Using the High-Level API of the AWS SDK for .NET](#create-vault-dotnet-highlevel)
+ [Creating a Vault Using the Low-Level API of the AWS SDK for .NET](#create-vault-dotnet-lowlevel)

## Creating a Vault Using the High-Level API of the AWS SDK for .NET
<a name="create-vault-dotnet-highlevel"></a>

The `ArchiveTransferManager` class of the high-level API provides the `CreateVault` method you can use to create a vault in an AWS Region.

### Example: Vault Operations Using the High-Level API of the AWS SDK for .NET
<a name="vault-operations-example-dotnet-highlevel"></a>

The following C\$1 code example creates and delete a vault in the US West (Oregon) Region. For a list of AWS Regions in which you can create vaults, see [Accessing Amazon Glacier](amazon-glacier-accessing.md). 

For step-by-step instructions on how to run the following example, see [Running Code Examples](using-aws-sdk-for-dot-net.md#setting-up-and-testing-sdk-dotnet). You need to update the code as shown with a vault name. 

**Example**  

```
using System;
using Amazon.Glacier;
using Amazon.Glacier.Transfer;
using Amazon.Runtime;

namespace glacier.amazon.com.rproxy.govskope.ca.docsamples
{
  class VaultCreateDescribeListVaultsDeleteHighLevel
  {
    static string vaultName = "*** Provide vault name ***";

    public static void Main(string[] args)
    {
      try
      {
          var manager = new ArchiveTransferManager(Amazon.RegionEndpoint.USWest2);
          manager.CreateVault(vaultName);
          Console.WriteLine("Vault created. To delete the vault, press Enter");
          Console.ReadKey();
          manager.DeleteVault(vaultName);
          Console.WriteLine("\nVault deleted. To continue, press Enter");
          Console.ReadKey();
      }
      catch (AmazonGlacierException e) { Console.WriteLine(e.Message); }
      catch (AmazonServiceException e) { Console.WriteLine(e.Message); }
      catch (Exception e) { Console.WriteLine(e.Message); }
      Console.WriteLine("To continue, press Enter");
      Console.ReadKey();
    }
  }
}
```

## Creating a Vault Using the Low-Level API of the AWS SDK for .NET
<a name="create-vault-dotnet-lowlevel"></a>

The low-level API provides methods for all the vault operations, including create and delete vaults, get a vault description, and get a list of vaults created in a specific AWS Region. The following are the steps to create a vault using the AWS SDK for .NET. 

 

1. Create an instance of the `AmazonGlacierClient` class (the client). 

   You need to specify an AWS Region in which you want to create a vault. All operations you perform using this client apply to that AWS Region.

1. Provide request information by creating an instance of the `CreateVaultRequest` class.

    Amazon Glacier (Amazon Glacier) requires you to provide a vault name and your account ID. If you don't provide an account ID, then account ID associated with the credentials you provide to sign the request is assumed. For more information, see [Using the AWS SDK for .NET with Amazon Glacier](using-aws-sdk-for-dot-net.md). 

1. Run the `CreateVault` method by providing the request object as a parameter. 

   The response Amazon Glacier returns is available in the `CreateVaultResponse` object.

### Example: Vault Operations Using the Low-Level API of the AWS SDK for .NET
<a name="vault-operations-example-dotnet-lowlevel"></a>

The following C\$1 example illustrates the preceding steps. The example creates a vault in the US West (Oregon) Region. In addition, the code example retrieves the vault information, lists all vaults in the same AWS Region, and then deletes the vault created. The `Location` printed is the relative URI of the vault that includes your account ID, the AWS Region, and the vault name.

**Note**  
For information about the underlying REST API, see [Create Vault (PUT vault)](api-vault-put.md). 

For step-by-step instructions on how to run the following example, see [Running Code Examples](using-aws-sdk-for-dot-net.md#setting-up-and-testing-sdk-dotnet). You need to update the code as shown with a vault name. 

**Example**  

```
using System;
using Amazon.Glacier;
using Amazon.Glacier.Model;
using Amazon.Runtime;

namespace glacier.amazon.com.rproxy.govskope.ca.docsamples
{
  class VaultCreateDescribeListVaultsDelete
  {
    static string vaultName = "*** Provide vault name ***";
    static AmazonGlacierClient client;

    public static void Main(string[] args)
    {
       try
      {
         using (client = new AmazonGlacierClient(Amazon.RegionEndpoint.USWest2))
        {
          Console.WriteLine("Creating a vault.");
          CreateAVault();
          DescribeVault();
          GetVaultsList();
          Console.WriteLine("\nVault created. Now press Enter to delete the vault...");
          Console.ReadKey();
          DeleteVault();
        }
      }
      catch (AmazonGlacierException e) { Console.WriteLine(e.Message); }
      catch (AmazonServiceException e) { Console.WriteLine(e.Message); }
      catch (Exception e) { Console.WriteLine(e.Message); }
      Console.WriteLine("To continue, press Enter");
      Console.ReadKey();
    }

    static void CreateAVault()
    {
      CreateVaultRequest request = new CreateVaultRequest()
      {
        VaultName = vaultName
      };
      CreateVaultResponse response = client.CreateVault(request);
      Console.WriteLine("Vault created: {0}\n", response.Location); 
    }

    static void DescribeVault()
    {
      DescribeVaultRequest describeVaultRequest = new DescribeVaultRequest()
      {
        VaultName = vaultName
      };
   
      DescribeVaultResponse describeVaultResponse = client.DescribeVault(describeVaultRequest);
      Console.WriteLine("\nVault description...");
      Console.WriteLine(
        "\nVaultName: " + describeVaultResponse.VaultName +
        "\nVaultARN: " + describeVaultResponse.VaultARN +
        "\nVaultCreationDate: " + describeVaultResponse.CreationDate +
        "\nNumberOfArchives: " + describeVaultResponse.NumberOfArchives +
        "\nSizeInBytes: " + describeVaultResponse.SizeInBytes +
        "\nLastInventoryDate: " + describeVaultResponse.LastInventoryDate 
        );
    }

    static void GetVaultsList()
    {
      string lastMarker = null;
      Console.WriteLine("\n List of vaults in your account in the specific region ...");
      do
      {
        ListVaultsRequest request = new ListVaultsRequest()
        {
          Marker = lastMarker
        };
        ListVaultsResponse response = client.ListVaults(request);
         
        foreach (DescribeVaultOutput output in response.VaultList)
        {
          Console.WriteLine("Vault Name: {0} \tCreation Date: {1} \t #of archives: {2}",
                            output.VaultName, output.CreationDate, output.NumberOfArchives); 
        }
        lastMarker = response.Marker;
      } while (lastMarker != null);
    }

    static void DeleteVault()
    {
      DeleteVaultRequest request = new DeleteVaultRequest()
      {
        VaultName = vaultName
      };
      DeleteVaultResponse response = client.DeleteVault(request);
    }
  }
}
```

# Creating a Vault in Amazon Glacier Using the REST API
<a name="creating-vaults-rest-api"></a>

To create a vault using the REST API, see [Create Vault (PUT vault)](api-vault-put.md). 

# Creating a Vault Using the Amazon Glacier Console
<a name="creating-vaults-console"></a>

To create a vault using the Amazon Glacier (Amazon Glacier) console, see [Step 2: Create a Vault in Amazon Glacier](getting-started-create-vault.md) in the *Getting Started* tutorial. 

# Creating a Vault in Amazon Glacier Using the AWS Command Line Interface
<a name="creating-vaults-cli"></a>

Follow these steps to create a vault in Amazon Glacier (Amazon Glacier) using the AWS Command Line Interface (AWS CLI).

**Topics**
+ [(Prerequisite) Setting Up the AWS CLI](#Creating-Vaults-CLI-Setup)
+ [Example: Creating a Vault Using the AWS CLI](#Creating-Vaults-CLI-Implementation)

## (Prerequisite) Setting Up the AWS CLI
<a name="Creating-Vaults-CLI-Setup"></a>

1. Download and configure the AWS CLI. For instructions, see the following topics in the *AWS Command Line Interface User Guide*: 

    [Installing the AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/installing.html) 

   [Configuring the AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)

1. Verify your AWS CLI setup by entering the following commands at the command prompt. These commands don't provide credentials explicitly, so the credentials of the default profile are used.
   + Try using the help command.

     ```
     aws help
     ```
   + To get a list of Amazon Glacier vaults on the configured account, use the `list-vaults` command. Replace *123456789012* with your AWS account ID.

     ```
     aws glacier list-vaults --account-id 123456789012
     ```
   + To see the current configuration data for the AWS CLI, use the `aws configure list` command.

     ```
     aws configure list
     ```

## Example: Creating a Vault Using the AWS CLI
<a name="Creating-Vaults-CLI-Implementation"></a>

1. Use the `create-vault` command to create a vault named *awsexamplevault* under account *111122223333*.

   ```
   aws glacier create-vault --vault-name awsexamplevault --account-id 111122223333
   ```

   Expected output:

   ```
   {
       "location": "/111122223333/vaults/awsexamplevault"
   }
   ```

1. Verify creation using the `describe-vault` command.

   ```
   aws glacier describe-vault --vault-name awsexamplevault --account-id 111122223333
   ```