AWS SDK for .NET
Developer Guide

Storing Archival Data Using Amazon S3 Glacier

The AWS SDK for .NET supports Amazon S3 Glacier, which is a storage service optimized for infrequently used data, or cold data. The service provides durable and extremely low-cost storage with security features for data archiving and backup. For more information, see Amazon S3 Glacier Developer Guide.

The following information introduces you to the Glacier programming models in the AWS SDK for .NET.

Programming Models

The AWS SDK for .NET provides two programming models for working with Glacier. The following information describes these models and why and how to use them.

Low-Level APIs

The AWS SDK for .NET provides low-level APIs for programming with Glacier. These low-level APIs map closely to the underlying REST API supported by Glacier. For each Glacier REST operation, the low-level APIs provide a corresponding method, a request object for you to provide request information, and a response object for you to process the Glacier response. The low-level APIs are the most complete implementation of the underlying Glacier operations.

The following example shows how to use the low-level APIs to list accessible vaults in Glacier:

// using Amazon.Glacier; // using Amazon.Glacier.Model; var client = new AmazonGlacierClient(); var request = new ListVaultsRequest(); var response = client.ListVaults(request); foreach (var vault in response.VaultList) { Console.WriteLine("Vault: {0}", vault.VaultName); Console.WriteLine(" Creation date: {0}", vault.CreationDate); Console.WriteLine(" Size in bytes: {0}", vault.SizeInBytes); Console.WriteLine(" Number of archives: {0}", vault.NumberOfArchives); try { var requestNotifications = new GetVaultNotificationsRequest { VaultName = vault.VaultName }; var responseNotifications = client.GetVaultNotifications(requestNotifications); Console.WriteLine(" Notifications:"); Console.WriteLine(" Topic: {0}", responseNotifications.VaultNotificationConfig.SNSTopic); var events = responseNotifications.VaultNotificationConfig.Events; if (events.Any()) { Console.WriteLine(" Events:"); foreach (var e in events) { Console.WriteLine("{0}", e); } } else { Console.WriteLine(" No events set."); } } catch (ResourceNotFoundException) { Console.WriteLine(" No notifications set."); } var requestJobs = new ListJobsRequest{ VaultName = vault.VaultName }; var responseJobs = client.ListJobs(requestJobs); var jobs = responseJobs.JobList; if (jobs.Any()) { Console.WriteLine(" Jobs:"); foreach (var job in jobs) { Console.WriteLine(" For job ID: {0}", job.JobId); Console.WriteLine("Archive ID: {0}", job.ArchiveId); Console.WriteLine("Archive size in bytes: {0}", job.ArchiveSizeInBytes.ToString()); Console.WriteLine("Completed: {0}", job.Completed); Console.WriteLine("Completion date: {0}", job.CompletionDate); Console.WriteLine("Creation date: {0}", job.CreationDate); Console.WriteLine("Inventory size in bytes: {0}", job.InventorySizeInBytes); Console.WriteLine("Job description: {0}", job.JobDescription); Console.WriteLine("Status code: {0}", job.StatusCode.Value); Console.WriteLine("Status message: {0}", job.StatusMessage); } } else { Console.WriteLine(" No jobs."); } }

For more examples, see:

For related API reference information, see Amazon.Glacier and Amazon.Glacier.

High-Level APIs

The AWS SDK for .NET provides high-level APIs for programming with Glacier. To further simplify application development, these high-level APIs offer a higher-level abstraction for some of the operations, including uploading an archive and downloading an archive or vault inventory.

For examples, see the following topics in the Amazon S3 Glacier Developer Guide:

For related API reference information, see Amazon.Glacier.Transfer in the AWS SDK for .NET API Reference.

On this page: