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

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.

Amazon Glacier (original standalone vault-based service) will no longer accept new customers starting December 15, 2025, with no impact to existing 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, Amazon recommends the Amazon S3 Glacier storage classes, which deliver a superior customer experience with S3 bucket-based APIs, full Amazon Web Services Region availability, lower costs, and Amazon service integration. If you want enhanced capabilities, consider migrating to Amazon S3 Glacier storage classes by using our Amazon Solutions Guidance for transferring data from Amazon Glacier vaults to Amazon S3 Glacier storage classes.

Deleting a Vault in Amazon Glacier Using the Amazon SDK for Java

The following are the steps to delete a vault using the low-level API of the Amazon SDK for Java.

  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 Java with Amazon Glacier.

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

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

The following Java code snippet illustrates the preceding steps.

try { DeleteVaultRequest request = new DeleteVaultRequest() .withVaultName("*** provide vault name ***"); client.deleteVault(request); System.out.println("Deleted vault: " + vaultName); } catch (Exception e) { System.err.println(e.getMessage()); }
Note

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

Example: Deleting a Vault Using the Amazon SDK for Java

For a working code example, see Example: Creating a Vault Using the Amazon SDK for Java. The Java code example shows basic vault operations including create and delete vault.