

 **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/).

# Using the AWS SDKs with Amazon Glacier
<a name="using-aws-sdk"></a>

AWS provides SDKs for you to develop applications for Amazon Glacier. The SDK libraries wrap the underlying Amazon Glacier API, simplifying your programming tasks. For example, for each request sent to Amazon Glacier, you must include a signature to authenticate your requests. When you use the SDK libraries, you need to provide only your AWS security credentials in your code and the libraries compute the necessary signature and include it in the request sent to Amazon Glacier. The AWS SDKs provide libraries that map to the underlying REST API and provide objects that you can use to easily construct requests and process responses. 

**Topics**
+ [AWS SDK Libraries for Java and .NET](#java-.net-sdk-libraries)
+ [Using Amazon Glacier with an AWS SDK](sdk-general-information-section.md)
+ [Using the AWS SDK for Java with Amazon Glacier](using-aws-sdk-for-java.md)
+ [Using the AWS SDK for .NET with Amazon Glacier](using-aws-sdk-for-dot-net.md)

The AWS Command Line Interface (AWS CLI) is a unified tool to manage your AWS services, including Amazon Glacier. For information about downloading the AWS CLI, see [AWS Command Line Interface](https://aws.amazon.com/cli/). For a list of the Amazon Glacier CLI commands, see the [AWS CLI Command Reference](https://docs.aws.amazon.com/cli/latest/reference/glacier/index.html). 

## AWS SDK Libraries for Java and .NET
<a name="java-.net-sdk-libraries"></a>

The AWS SDKs for Java and .NET offer high-level and low-level wrapper libraries. 

You can find examples of working with Amazon Glacier by using the AWS SDK for Java and the AWS SDK for .NET throughout this developer guide. 

### What Is the Low-Level API?
<a name="what-is-low-level-api"></a>

The low-level wrapper libraries map closely the underlying REST API ([API Reference for Amazon Glacier](amazon-glacier-api.md)) supported by Amazon Glacier. For each Amazon Glacier REST operations, the low-level API provides a corresponding method, a request object for you to provide request information and a response object for you to process Amazon Glacier response. The low-level wrapper libraries are the most complete implementation of the underlying Amazon Glacier operations. 

For information about these SDK libraries, see [Using the AWS SDK for Java with Amazon Glacier](using-aws-sdk-for-java.md) and [Using the AWS SDK for .NET with Amazon Glacier](using-aws-sdk-for-dot-net.md).

### What Is the High-Level API?
<a name="what-is-high-level-api"></a>

To further simplify application development, these libraries offer a higher-level abstraction for some of the operations. For example: 
+ Uploading an archive—To upload an archive using the low-level API in addition to the file name and the vault name where you want to save the archive, You need to provide a checksum (SHA-256 tree hash) of the payload. However, the high-level API computes the checksum for you.
+ Downloading an archive or vault inventory—To download an archive using the low-level API you first initiate a job, wait for the job to complete, and then get the job output. You need to write additional code to set up an Amazon Simple Notification Service (Amazon SNS) topic for Amazon Glacier to notify you when the job is complete. You also need some polling mechanism to check if a job completion message was posted to the topic. The high-level API provides a method to download an archive that takes care of all these steps. You only specify an archive ID and a folder path where you want to save the downloaded data. 

For information about these SDK libraries, see [Using the AWS SDK for Java with Amazon Glacier](using-aws-sdk-for-java.md) and [Using the AWS SDK for .NET with Amazon Glacier](using-aws-sdk-for-dot-net.md).

### When to Use the High-Level and Low-Level API
<a name="when-to-use-high-low-api"></a>

In general, if the high-level API provides methods you need to perform an operation, you should use the high-level API because of the simplicity it provides. However, if the high-level API does not offer the functionality, you can use the low-level API. Additionally, the low-level API allows granular control of the operation such as retry logic in the event of a failure. For example, when uploading an archive the high-level API uses the file size to determine whether to upload the archive in a single operation or use the multipart upload API. The API also has built-in retry logic in case an upload fails. However, your application might need granular control over these decisions, in which case you can use the low-level API.

# Using Amazon Glacier with an AWS SDK
<a name="sdk-general-information-section"></a>

AWS software development kits (SDKs) are available for many popular programming languages. Each SDK provides an API, code examples, and documentation that make it easier for developers to build applications in their preferred language.


| SDK documentation | Code examples | 
| --- | --- | 
| [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/sdk-for-cpp) | [AWS SDK for C\$1\$1 code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/cpp) | 
| [AWS CLI](https://docs.aws.amazon.com/cli) | [AWS CLI code examples](https://docs.aws.amazon.com/code-library/latest/ug/cli_2_code_examples.html) | 
| [AWS SDK for Go](https://docs.aws.amazon.com/sdk-for-go) | [AWS SDK for Go code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/gov2) | 
| [AWS SDK for Java](https://docs.aws.amazon.com/sdk-for-java) | [AWS SDK for Java code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2) | 
| [AWS SDK for JavaScript](https://docs.aws.amazon.com/sdk-for-javascript) | [AWS SDK for JavaScript code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javascriptv3) | 
| [AWS SDK for Kotlin](https://docs.aws.amazon.com/sdk-for-kotlin) | [AWS SDK for Kotlin code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/kotlin) | 
| [AWS SDK for .NET](https://docs.aws.amazon.com/sdk-for-net) | [AWS SDK for .NET code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv3) | 
| [AWS SDK for PHP](https://docs.aws.amazon.com/sdk-for-php) | [AWS SDK for PHP code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/php) | 
| [AWS Tools for PowerShell](https://docs.aws.amazon.com/powershell) | [AWS Tools for PowerShell code examples](https://docs.aws.amazon.com/code-library/latest/ug/powershell_5_code_examples.html) | 
| [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/pythonsdk) | [AWS SDK for Python (Boto3) code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python) | 
| [AWS SDK for Ruby](https://docs.aws.amazon.com/sdk-for-ruby) | [AWS SDK for Ruby code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/ruby) | 
| [AWS SDK for Rust](https://docs.aws.amazon.com/sdk-for-rust) | [AWS SDK for Rust code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/rustv1) | 
| [AWS SDK for SAP ABAP](https://docs.aws.amazon.com/sdk-for-sapabap) | [AWS SDK for SAP ABAP code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap) | 
| [AWS SDK for Swift](https://docs.aws.amazon.com/sdk-for-swift) | [AWS SDK for Swift code examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/swift) | 

For examples specific to Amazon Glacier, see [Code examples for Amazon Glacier using AWS SDKs](service_code_examples.md).

**Example availability**  
Can't find what you need? Request a code example by using the **Provide feedback** link at the bottom of this page.

# Using the AWS SDK for Java with Amazon Glacier
<a name="using-aws-sdk-for-java"></a>

The AWS SDK for Java provides both high-level and low-level APIs for Amazon Glacier (Amazon Glacier) as described in [Using the AWS SDKs with Amazon Glacier](using-aws-sdk.md). For information about downloading the AWS SDK for Java, see [Amazon SDK for Java](http://aws.amazon.com/sdkforjava/).

**Note**  
The AWS SDK for Java provides thread-safe clients for accessing Amazon Glacier. As a best practice, your applications should create one client and reuse the client between threads.

**Topics**
+ [Using the Low-Level API](#about-low-level-java-api)
+ [Using the High-Level API](#about-high-level-java-api)
+ [Running Java Examples for Amazon Glacier Using Eclipse](#setting-up-and-testing-sdk-java)
+ [Setting the Endpoint](#setting-sdk-java-endpoint)

## Using the Low-Level API
<a name="about-low-level-java-api"></a>

The low-level `AmazonGlacierClient` class provides all the methods that map to the underlying REST operations of Amazon Glacier ( [API Reference for Amazon Glacier](amazon-glacier-api.md)). When calling any of these methods, you must create a corresponding request object and provide a response object in which the method can return the Amazon Glacier response to the operation. 

For example, the `AmazonGlacierClient` class provides the `createVault` method to create a vault. This method maps to the underlying Create Vault REST operation (see [Create Vault (PUT vault)](api-vault-put.md)). To use this method, you must create instances of the `CreateVaultResult` object that receives the Amazon Glacier response as shown in the following Java code snippet:

 

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

CreateVaultRequest request = new CreateVaultRequest()
    .withAccountId("-")
    .withVaultName(vaultName);
CreateVaultResult result = client.createVault(createVaultRequest);
```

All the low-level samples in the guide use this pattern. 

 

**Note**  
The preceding code segment specifies `AccountID` when creating the request. However, when using the AWS SDK for Java, the `AccountId` in the request is optional, and therefore all the low-level examples in this guide don't set this value. The `AccountId` is the AWS account ID. This value must match the AWS account ID associated with the credentials used to sign the request. You can specify either the AWS account ID or optionally a '-', in which case Amazon Glacier uses the AWS account ID associated with the credentials used to sign the request. If you specify your Account ID, do not include hyphens in it. When using AWS SDK for Java, if you don't provide the account ID, the library sets the account ID to '-'. 

## Using the High-Level API
<a name="about-high-level-java-api"></a>

To further simplify your application development, the AWS SDK for Java provides the `ArchiveTransferManager` class that implements a higher-level abstraction for the some of the methods in the low-level API. It provides useful methods, such as the `upload` and `download` methods for archive operations. 

For example, the following Java code snippet uses the `upload` high-level method to upload an archive. 

 

```
String vaultName = "examplevault";
String archiveToUpload = "c:/folder/exampleArchive.zip";

ArchiveTransferManager atm = new ArchiveTransferManager(client, credentials);
String archiveId = atm.upload(vaultName, "Tax 2012 documents", new File(archiveToUpload)).getArchiveId();
```

Note that any operations you perform apply to the AWS Region you specified when creating the `ArchiveTransferManager` object. If you don't specify any AWS Region, the AWS SDK for Java sets `us-east-1` as the default AWS Region.

All the high-level examples in this guide use this pattern. 

 

**Note**  
The high-level `ArchiveTransferManager` class can be constructed with an `AmazonGlacierClient` instance or an `AWSCredentials` instance.

## Running Java Examples for Amazon Glacier Using Eclipse
<a name="setting-up-and-testing-sdk-java"></a>

The easiest way to get started with the Java code examples is to install the latest AWS Toolkit for Eclipse. For information on installing or updating to the latest toolkit, go to [http://aws.amazon.com/eclipse](http://aws.amazon.com/eclipse). The following tasks guide you through the creation and testing of the Java code examples provided in this section.


**General Process of Creating Java Code Examples**  

|  |  | 
| --- |--- |
| 1 |  Create a default credentials profile for your AWS credentials as described in the AWS SDK for Java topic [Providing AWS Credentials in the Amazon SDK for Java](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html).   | 
| 2 | Create a new AWS Java project in Eclipse. The project is pre-configured with the AWS SDK for Java. | 
| 3 | Copy the code from the section you are reading to your project.  | 
| 4 | Update the code by providing any required data. For example, if uploading a file, provide the file path and the bucket name. | 
| 5 | Run the code. Verify that the object is created by using the AWS Management Console. For more information about the AWS Management Console, go to [http://aws.amazon.com/console/](http://aws.amazon.com/console/). | 

## Setting the Endpoint
<a name="setting-sdk-java-endpoint"></a>

By default, the AWS SDK for Java uses the endpoint `https://glacier.us-east-1.amazonaws.com`. You can set the endpoint explicitly as shown in the following Java code snippets.

The following snippet shows how to set the endpoint to the US West (Oregon) Region (`us-west-2`) in the low-level API.

**Example**  

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

The following snippet shows how to set the endpoint to the US West (Oregon) Region in the high-level API.

 

```
glacierClient = new AmazonGlacierClient(credentials);
sqsClient = new AmazonSQSClient(credentials);
snsClient = new AmazonSNSClient(credentials);
        
glacierClient.setEndpoint("glacier.us-west-2.amazonaws.com");
sqsClient.setEndpoint("sqs.us-west-2.amazonaws.com");
snsClient.setEndpoint("sns.us-west-2.amazonaws.com");

ArchiveTransferManager atm = new ArchiveTransferManager(glacierClient, sqsClient, snsClient);
```

For a list of supported AWS Regions and endpoints, see [Accessing Amazon Glacier](amazon-glacier-accessing.md).

# Using the AWS SDK for .NET with Amazon Glacier
<a name="using-aws-sdk-for-dot-net"></a>

The AWS SDK for .NET API is available in `AWSSDK.dll`. For information about downloading the AWS SDK for .NET, go to [Sample Code Libraries](http://aws.amazon.com/sdkfornet/). As described in [Using the AWS SDKs with Amazon Glacier](using-aws-sdk.md), the AWS SDK for .NET provides both the high-level and low-level APIs. 

**Note**  
The low-level API and high-level API provide thread-safe clients for accessing Amazon Glacier. As a best practice, your applications should create one client and reuse the client between threads.

**Topics**
+ [Using the Low-Level API](#about-low-level-dotnet-api)
+ [Using the High-Level API](#about-high-level-dotnet-api)
+ [Running Code Examples](#setting-up-and-testing-sdk-dotnet)
+ [Setting the Endpoint](#setting-sdk-dot-net-endpoint)

## Using the Low-Level API
<a name="about-low-level-dotnet-api"></a>

The low-level `AmazonGlacierClient` class provides all the methods that map to the underlying REST operations of Amazon Glacier (Amazon Glacier) ( [API Reference for Amazon Glacier](amazon-glacier-api.md)). When calling any of these methods, you must create a corresponding request object and provide a response object in which the method can return a Amazon Glacier response to the operation. 

For example, the `AmazonGlacierClient` class provides the `CreateVault` method to create a vault. This method maps to the underlying Create Vault REST operation (see [Create Vault (PUT vault)](api-vault-put.md)). To use this method, you must create instances of the `CreateVaultRequest` and `CreateVaultResponse` classes to provide request information and receive a Amazon Glacier response as shown in the following C\$1 code snippet:

 

```
AmazonGlacierClient client;
client = new AmazonGlacierClient(Amazon.RegionEndpoint.USEast1); 

CreateVaultRequest request = new CreateVaultRequest()
{
  AccountId = "-",
  VaultName = "*** Provide vault name ***"
};

CreateVaultResponse response = client.CreateVault(request);
```

All the low-level samples in the guide use this pattern. 

 

**Note**  
The preceding code segment specifies `AccountId` when creating the request. However, when using the AWS SDK for .NET, the `AccountId` in the request is optional, and therefore all the low-level examples in this guide don't set this value. The `AccountId` is the AWS account ID. This value must match the AWS account ID associated with the credentials used to sign the request. You can specify either the AWS account ID or optionally a '-', in which case Amazon Glacier uses the AWS account ID associated with the credentials used to sign the request. If you specify your Account ID, do not include hyphens in it. When using AWS SDK for .NET, if you don't provide the account ID, the library sets the account ID to '-'. 

## Using the High-Level API
<a name="about-high-level-dotnet-api"></a>

To further simplify your application development, the AWS SDK for .NET provides the `ArchiveTransferManager` class that implements a higher-level abstraction for some of the methods in the low-level API. It provides useful methods, such as `Upload` and `Download`, for the archive operations. 

For example, the following C\$1 code snippet uses the `Upload` high-level method to upload an archive. 

 

```
string vaultName = "examplevault";
string archiveToUpload = "c:\folder\exampleArchive.zip";

var manager = new ArchiveTransferManager(Amazon.RegionEndpoint.USEast1);
string archiveId = manager.Upload(vaultName, "archive description", archiveToUpload).ArchiveId;
```

Note that any operations you perform apply to the AWS Region you specified when creating the `ArchiveTransferManager` object. All the high-level examples in this guide use this pattern. 

 

**Note**  
The high-level `ArchiveTransferManager` class still needs the low-level `AmazonGlacierClient` client, which you can pass either explicitly or the `ArchiveTransferManager` creates the client.

## Running Code Examples
<a name="setting-up-and-testing-sdk-dotnet"></a>

The easiest way to get started with the .NET code examples is to install the AWS SDK for .NET. For more information, go to [Amazon SDK for .NET](http://aws.amazon.com/sdkfornet/). 

The following procedure outlines steps for you to test the code examples provided in this guide.


**General Process of Creating .NET Code Examples (Using Visual Studio)**  

|  |  | 
| --- |--- |
| 1 | Create a credentials profile for your AWS credentials as described in the Amazon SDK for .NET topic [Configuring AWS credentials](http://docs.aws.amazon.com/sdk-for-net/v4/developer-guide/creds-assign.html).  | 
| 2 |  Create a new Visual Studio project using the *AWS Empty Project* template.   | 
| 3 | Replace the code in the project file, `Program.cs`, with the code in the section you are reading.  | 
| 4 |   Run the code. Verify that the object is created using the AWS Management Console. For more information about AWS Management Console, go to [http://aws.amazon.com/console/](http://aws.amazon.com/console/).  | 

## Setting the Endpoint
<a name="setting-sdk-dot-net-endpoint"></a>

By default, the AWS SDK for .NET sets the endpoint to the US West (Oregon) Region (`https://glacier.us-west-2.amazonaws.com`). You can set the endpoint to other AWS Regions as shown in the following C\$1 snippets.

The following snippet shows how to set the endpoint to the US West (Oregon) Region (`us-west-2`) in the low-level API.

**Example**  

```
AmazonGlacierClient client = new AmazonGlacierClient(Amazon.RegionEndpoint.USWest2);
```

The following snippet shows how to set the endpoint to the US West (Oregon) Region in the high-level API.

 

```
var manager = new ArchiveTransferManager(Amazon.RegionEndpoint.USWest2);
```

For a current list of supported AWS Regions and endpoints, see [Accessing Amazon Glacier](amazon-glacier-accessing.md).