# Glacier task

Amazon Glacier is storage for things that are kept and rarely read. It is cheap, and slow on purpose: even asking a vault what it holds takes hours. A Glacier task asks that question and brings the answer home, so that the server knows what is in a vault and can show it like a folder.

Storing files in Glacier is not this task's business, whatever the task picker's line "Store or restore an object in Amazon Glacier." suggests: that is a [Copy](Task-Copy.md) to a `glacier://` address. See [VFS: Glacier](VFS-Glacier.md).

## Fields

| Field | What it does | On a new task |
|---|---|---|
| **Glacier Vault** | the vault, as a `glacier://` address with its keys. **Browse**. "The url must point to an Amazone Glacier location!" for anything else. | |
| **Wait till complete** | the task waits until Amazon has the list ready, fetches it and works it in. Unticked, the task only places the request and goes on. | off |

## How it works

1. The task asks Amazon for the vault's inventory. Amazon answers with the id of a job of its own: "Created Amazone Job! The job Id : …".
2. Amazon prepares the list. That takes several hours.
3. With **Wait till complete**, the task asks about once a minute how far Amazon is: "JOB STATUS : INPROGRESS". The run stays running all that time.
4. When the status is Succeeded, the task fetches the list and makes the server's own record of the vault from it: "Download inventory and process it.", then a line per folder and file.

The id of Amazon's job is kept with the run. A run that is stopped and resumed goes on waiting for the same job; it does not ask Amazon a second time.

## What it hands on

The items it was given. The run has `{amazon_job_id}` and `{amazon_job_satus}` for the tasks that follow.

## Uses

- **After a restore of the server**, or on a new server that shall see a vault that others have filled: one run with **Wait till complete**.
- **Regularly**, when files are also put into the vault by other programs: once a week, at night.

A server that is the only one writing to a vault knows what it put there and does not need this task.

## Things to know

- **Give the job time.** With **Wait till complete** a run takes hours. Leave the job's **Max runtime** empty or generous, and tick **Single instance only**.
- **Amazon's list is up to a day old.** A file stored an hour ago may not be in it yet. So there is no point in asking more than once a day.
- **Getting files back** out of Glacier is slow too: a download from a `glacier://` address first asks Amazon to make the file ready.
- **Newer storage classes.** Amazon now offers Glacier as storage classes of S3, which are reached as ordinary S3 buckets and need none of this: see [VFS: S3](VFS-S3.md). Vaults are the older form.
