Code examples for S3 Glacier using Amazon SDKs - Amazon S3 Glacier
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Code examples for S3 Glacier using Amazon SDKs

The following code examples show how to use S3 Glacier with an Amazon software development kit (SDK).

Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios and cross-service examples.

Scenarios are code examples that show you how to accomplish a specific task by calling multiple functions within the same service.

For a complete list of Amazon SDK developer guides and code examples, see Using S3 Glacier with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.

Get started

The following code example shows how to get started using Amazon S3 Glacier.

Amazon SDK for .NET

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

using Amazon.Glacier; using Amazon.Glacier.Model; namespace GlacierActions; public static class HelloGlacier { static async Task Main() { var glacierService = new AmazonGlacierClient(); Console.WriteLine("Hello Amazon Glacier!"); Console.WriteLine("Let's list your Glacier vaults:"); // You can use await and any of the async methods to get a response. // Let's get the vaults using a paginator. var glacierVaultPaginator = glacierService.Paginators.ListVaults( new ListVaultsRequest { AccountId = "-" }); await foreach (var vault in glacierVaultPaginator.VaultList) { Console.WriteLine($"{vault.CreationDate}:{vault.VaultName}, ARN:{vault.VaultARN}"); } } }
  • For API details, see ListVaults in Amazon SDK for .NET API Reference.