# Amazon Glacier

Amazon S3 Glacier, in its original form with **vaults**, is storage for archives: cheap to keep, slow to get back. An item of a [VFS](VFS.md) of the type **Glacier** lets users put files into a vault as they would upload them anywhere.

Nothing has to be installed for it: the server speaks to Glacier by itself.

> [!NOTE]
> This page is about Glacier vaults. The storage classes named GLACIER and DEEP_ARCHIVE of an ordinary S3 bucket are something else: for them, use an [S3](VFS-S3.md) item and choose the **Storage class**.

![A Glacier item](VFS-Glacier/dialog.png)

## The item

| Field | What it is |
|---|---|
| **Server** | the Glacier endpoint of the region, such as `glacier.eu-central-1.amazonaws.com` |
| **User name**, **Password** | an access key ID and its secret access key, of a user that may use Glacier |
| **Vault Name** | the vault. Empty: the item lists the vaults of the region, and files can be uploaded only inside one of them. |
| **Delete local representation after upload** | see below |
| **Use KeyVault Connection Profile** | takes the key from a vault for secrets: see [Special types](VFS-Special-Types.md#keyvault) |

The address they make is `glacier://KEYID:SECRET@glacier.REGION.amazonaws.com/`.

## How the server makes folders of it

A vault has no folders and no file names. It holds archives, each with an ID and a short description.

So the server keeps the tree itself, on its own disk: for every file that is uploaded, a small pointer file is written in the folder `glacier` of the server's folder, under the vault's name and the path the user sees. Listings, sizes, dates and renames work on these pointer files. The path is also written into the archive's description in the vault.

| **Delete local representation after upload** | Means |
|---|---|
| off | the user sees what they uploaded, as files in folders |
| on | the pointer is removed a moment after the upload. The folder stays empty: a pure drop slot into the archive. |

Back up the `glacier` folder with the server. Its place can be changed with the Java setting `crushmft.glacier_root` on the server's command line.

## Getting files back

Reading from a vault is not a download. An archive must be requested from Amazon, is made ready within hours, and is then available for a limited time. Do not give users a Glacier item to work in. Use it as the last step of a flow: a job that moves files into the vault when they are a year old.

## Archives that were not uploaded through CrushMFT

A vault that was filled by other means has no pointer files. The **Glacier** task of the job designer rebuilds them from the vault's inventory:

1. The first run asks Amazon for the inventory of the vault. Amazon needs some hours for it.
2. A later run fetches the finished inventory and writes a pointer file for every archive whose description names a path.

The options every type has are on [Advanced options of a VFS item](VFS-Advanced.md).

## When it does not work

| What you see | Usually |
|---|---|
| the login is refused | the keys; a user without rights on Glacier; the clock of the machine |
| the vault is not listed | another region: choose its endpoint under **Server** |
| uploads are refused at the top | files can only go into a vault: name it in **Vault Name**, or go into a vault's folder |
| files vanish after the upload | **Delete local representation after upload** is on |
