amazon-web-servicesaws-cliamazon-glacier

Unable to retrieve archiveId using definition job in AWS Glacier


I am currently working on deleting an archive from AWS Glacier using the AWS CLI. I have initiated a job using the aws glacier initiate-job command, after job completed I try to retrieve the archiveId by using aws glacier get-job-output, but I am unable to find the archiveId in the output.

Here is the command I am using:

aws glacier get-job-output --account-id 123456678 --job-id aws-job-id --vault-name my-vault output.json

Output of the above command:

{
    "status": 200,
    "acceptRanges": "bytes",
    "contentType": "application/json"
}

The output I receive does not contain the archiveId, which is essential for the subsequent deletion process. I have also checked the following aws documentation.


Solution

  • Here is the command you ran:

    aws glacier get-job-output --account-id 123456678 --job-id aws-job-id --vault-name my-vault output.json
    

    Note the last parameter: output.json

    This specified that you would like the output stored (on your local disk) in a file called output.json.

    Take a look at that file and you should find some output like:

    {
        "VaultARN": "arn:aws:glacier:us-west-2:0123456789012:vaults/my-vault",
        "InventoryDate": "2015-04-07T00:26:18Z",
        "ArchiveList": [
            {
                "ArchiveId": "kKB7ymWJVpPSwhGP6ycSOAekp9ZYe_--zM_mw6k76ZFGEIWQX-ybtRDvc2VkPSDtfKmQrj0IRQLSGsNuDp-AJVlu2ccmDSyDUmZwKbwbpAdGATGDiB3hHO0bjbGehXTcApVud_wyDw",
                "ArchiveDescription": "multipart upload test",
                "CreationDate": "2015-04-06T22:24:34Z",
                "Size": 3145728,
                "SHA256TreeHash": "9628195fcdbcbbe76cdde932d4646fa7de5f219fb39823836d81f0cc0e18aa67"
            }
        ]
    }
    

    The ArchiveId is in that output.