amazon-web-servicesfogamazon-glacier

unable to delete glacier vault because not empty, but not able to delete archives


I created a Glacier vault in the AWS web console then programmatically created a few test archives using the Fog gem.

I would like to delete the vault, but the web console won't let me because it says the vault isn't empty. It's telling me the vault contains two archives and shows the last inventory date as "February 05, 2016 07:01:28 PM UTC-8".

When I access the vault using Fog it shows the same last inventory date, but the "vault" object returned by Fog contains no archives. "vault.archives" is an empty collection.

I figured I just needed to submit an inventory job, so I did. When the job completed, here was its output:

{"VaultARN"=>"EDITED",
 "InventoryDate"=>"2016-02-06T01:01:28Z",
 "ArchiveList"=>
  [{"ArchiveId"=>
     "EDITED: ARCHIVE ID",
    "ArchiveDescription"=>"test",
    "CreationDate"=>"2016-02-05T21:16:52Z",
    "Size"=>4,
    "SHA256TreeHash"=>
     "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"},
   {"ArchiveId"=>
     "EDITED: ARCHIVE ID",
    "ArchiveDescription"=>"test",
    "CreationDate"=>"2016-02-05T21:23:08Z",
    "Size"=>4,
    "SHA256TreeHash"=>
     "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"}]}

It shows the vault as containing two archives. However, when I try to destroy either of them using Fog, I get this response:

#<Excon::Response:0x007ffe12ce5cd0
 @body="",
 @data=
  {:body=>"",
   :headers=>
    {"x-amzn-RequestId"=>"wupVQJALcVeGOC-hp4MsUgApY5CyhW8TdBoILGM3xBYH1aI",
     "Date"=>"Tue, 09 Feb 2016 16:30:13 GMT"},
   :status=>204,
   :status_line=>"HTTP/1.1 204 No Content\r\n",
   :reason_phrase=>"No Content",
   :remote_ip=>"EDITED",
   :local_port=>51722,
   :local_address=>"EDITED"},
 @headers=
  {"x-amzn-RequestId"=>"wupVQJALcVeGOC-hp4MsUgApY5CyhW8TdBoILGM3xBYH1aI",
   "Date"=>"Tue, 09 Feb 2016 16:30:13 GMT"},
 @local_address="EDITED",
 @local_port=51722,
 @remote_ip="EDITED",
 @status=204>

That's the response I would expect to get if I passed the wrong archive ID. But I'm positive I'm passing the same archive ID that was returned in my inventory job.

What gives? All I want to do is delete these two archives so I can then delete the vault.


Solution

  • It is possible that I am misunderstanding your question... but to me, you seem to be misunderstanding the meaning of 204 No Content.

    It doesn't mean "nothing was there." That would a 4XX class error.

    204 No Content means "the operation succeeded, and this operation does not return a response body." If a web browser is greeted with a 204 response from a web server, it's not supposed to change the document you're viewing (while 200 OK with an empty response body would have the same semantic meaning ("success"), but would leave you staring at a white window). Of course, you're not a web browser, but that's the reason for the 204 code.

    I think what you just did has accomplished what you intended, though it's possible you might have to wait for a few more hours to pass and inventory the vault again.

    If the request is successful, Amazon Glacier responds with 204 No Content to indicate that the archive is deleted.

    http://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html