Deleting a Vault in Amazon S3 Glacier Using the Amazon SDK for .NET - 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).

If you're new to archival storage in Amazon Simple Storage Service (Amazon S3), we recommend that you start by learning more about the S3 Glacier storage classes in Amazon S3, S3 Glacier Instant Retrieval, S3 Glacier Flexible Retrieval, and S3 Glacier Deep Archive. For more information, see S3 Glacier storage classes and Storage classes for archiving objects in the Amazon S3 User Guide.

Deleting a Vault in Amazon S3 Glacier Using the Amazon SDK for .NET

Both the high-level and low-level APIs provided by the Amazon SDK for .NET provide a method to delete a vault.

Deleting a Vault Using the High-Level API of the Amazon SDK for .NET

The ArchiveTransferManager class of the high-level API provides the DeleteVault method you can use to delete a vault.

Example: Deleting a Vault Using the High-Level API of the Amazon SDK for .NET

For a working code example, see Example: Vault Operations Using the High-Level API of the Amazon SDK for .NET. The C# code example shows basic vault operations including create and delete vault.

Deleting a Vault Using the Low-Level API of the Amazon SDK for .NET

The following are the steps to delete a vault using the Amazon SDK for .NET.

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

    You need to specify an Amazon Region from where you want to delete a vault. All operations you perform using this client apply to that Amazon Region.

  2. Provide request information by creating an instance of the DeleteVaultRequest class.

    You need to provide the vault name and 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 Amazon SDK for .NET with Amazon S3 Glacier.

  3. Run the DeleteVault method by providing the request object as a parameter.

    Amazon S3 Glacier (S3 Glacier) deletes the vault only if it is empty. For more information, see Delete Vault (DELETE vault).

The following C# code snippet illustrates the preceding steps. The snippet retrieves metadata information of a vault that exists in the default Amazon Region.

AmazonGlacier client; client = new AmazonGlacierClient(Amazon.RegionEndpoint.USEast1); DeleteVaultRequest request = new DeleteVaultRequest() { VaultName = "*** provide vault name ***" }; DeleteVaultResponse response = client.DeleteVault(request);
Note

For information about the underlying REST API, see Delete Vault (DELETE vault).

Example: Deleting a Vault Using the Low-Level API of the Amazon SDK for .NET

For a working code example, see Example: Vault Operations Using the Low-Level API of the Amazon SDK for .NET. The C# code example shows basic vault operations including create and delete vault.