amazon-web-servicesamazon-snsamazon-glacier

Amazon Glacier: How to Associate an Archive-Retrieval SNS Response With It's Job ID?


I have a service that archives zip files to Glacier. I have a Simple Notification Service set up to let me know when an unarchive job is finished ("Archive-Retrieval" request). From everything I can tell the response is going to be the same as the GetJob() call:

HTTP/1.1 200 OK 
x-amzn-RequestId: x-amzn-RequestId 
Date: Date
Content-Type: ContentType Content-Length: Length
x-amz-sha256-tree-hash: ChecksumComputedByAmazonGlacier

[Bytes of requested file.]

(source)

For processing purposes I need to be able to take the response and do processing (mark who unarchived the file, place it's contents in the correct place, etc). Is there any way to associate an incoming GetJob() response with a Job ID or something similar?

Thanks,

Zach


Solution

  • The body of the SNS message will contain the Job ID that was returned from the InitiateJob request. Below is a sample SNS JSON body for a Glacier retrieval request:

    {
       "Action":"ArchiveRetrieval", 
       "ArchiveId":"ewhHkrpO1sNPI4sFpDK7y0xFVNSR-eHEYrbWR2XKfRSy0Mf6f77T6P_9RhBLBqwn09k9AkcB0h03pyJiKxCfXRCVUDbvvTl7vJHbZO2ozTgunqbJ88p3uY1ytfhTDf_41PysxSmz_Q", 
       "ArchiveSHA256TreeHash":"34bbe1a578aa9a7ce3ada96e6e291821bd34b1fee403e3653a32d0a4ab0c7194", 
       "ArchiveSizeInBytes":1100754352, 
       "Completed":true, 
       "CompletionDate":"2013-03-12T22:17:29.692Z", 
       "CreationDate":"2013-03-12T18:17:13.938Z", 
       "InventorySizeInBytes":null, 
       "JobDescription":null, 
       "JobId":"uwa_RxWK39KIY0UGfgL38OWxQw234I8Gpre93LgW8VAl93Ts6VffRZyMbzZqjIh3GqqkiArv9oAXBRNXuUFfFko8bdcF", 
       "RetrievalByteRange":"0-1100754351", 
       "SHA256TreeHash":"34bbe1a578aa9a7ce3ada96e6e291821bd34b1fee403e3653a32d0a4ab0c7194", 
       "SNSTopic":null, 
       "StatusCode":"Succeeded", 
       "StatusMessage":"Succeeded", 
       "VaultARN":"..."
    }
    

    You can pass the JobId field to a GetJobOutput request to download the content of the archive. This value can be correlated to the original InitiateJob response via the x-amz-job-id header.