Search code examples
javaamazon-web-servicesamazon-glacier

Amazon Glacier - Get list of archives in a vault


We have a 3rd party amazon-glacier vault which we want to access and download data form there. Is there a way via the JAVA SDK/3rd party library to get the list of archiveIDs that are present in a vault ? As I far I played around with the sdk, the describeVault() returns only the number of archives in the vault, and not the list itself. If I get the list of archiveIDs I can create/initiate jobs for all the archives as per my use case. The boto python library does have this functionality, is there a way to do this in JAVA ?


Solution

  • Yes, this is possible in Java, as is in all AWS SDKs.

    There are two steps to retrieve a list of archives that are present in a vault:

    1. Call AmazonGlacierClient.initiateJob (docs) to request an inventory retrieval, with type in JobParameters set to inventory-retrieval

    Wait a couple of hours for the job to complete, and then

    1. Call AmazonGlacierClient.getJobOutput (docs) to retrieve the inventory, which contains the list of archives and their corresponding archiveIDs in one vault.