Skip to content

AWS.Glacier reference

Source: src/AWS/Glacier/AbortMultipartUpload.ts

Runtime binding for the AbortMultipartUpload operation (IAM action glacier:AbortMultipartUpload on the vault ARN).

Aborts an in-progress multipart upload on the bound Vault, freeing its uploaded parts. Aborting an already-aborted or completed upload fails with the typed ResourceNotFoundException. Provide the implementation with Effect.provide(AWS.Glacier.AbortMultipartUploadHttp).

const abortMultipartUpload = yield* AWS.Glacier.AbortMultipartUpload(vault);
yield* abortMultipartUpload({ uploadId });

Source: src/AWS/Glacier/CompleteMultipartUpload.ts

Runtime binding for the CompleteMultipartUpload operation (IAM action glacier:CompleteMultipartUpload on the vault ARN).

Assembles the uploaded parts of a multipart upload into an archive in the bound Vault. archiveSize is the total size in bytes (as a string) and checksum the SHA-256 tree hash of the whole archive; the response carries the new archiveId. Provide the implementation with Effect.provide(AWS.Glacier.CompleteMultipartUploadHttp).

CompleteMultipartUpload: Uploading Archives

Section titled “CompleteMultipartUpload: Uploading Archives”
const completeMultipartUpload =
yield* AWS.Glacier.CompleteMultipartUpload(vault);
const { archiveId } = yield* completeMultipartUpload({
uploadId,
archiveSize: String(totalSize),
checksum: treeHash,
});

Source: src/AWS/Glacier/DeleteArchive.ts

Runtime binding for the DeleteArchive operation (IAM action glacier:DeleteArchive on the vault ARN).

Deletes an archive from the bound Vault. The operation is idempotent — deleting an already-deleted archive is not an error. Provide the implementation with Effect.provide(AWS.Glacier.DeleteArchiveHttp).

const deleteArchive = yield* AWS.Glacier.DeleteArchive(vault);
yield* deleteArchive({ archiveId });

Source: src/AWS/Glacier/DescribeJob.ts

Runtime binding for the DescribeJob operation (IAM action glacier:DescribeJob on the vault ARN).

Reads the status of a job previously started with InitiateJob on the bound Vault — its action, status code, and completion flag. Provide the implementation with Effect.provide(AWS.Glacier.DescribeJobHttp).

const describeJob = yield* AWS.Glacier.DescribeJob(vault);
const job = yield* describeJob({ jobId });
if (job.Completed) {
// fetch with GetJobOutput
}

Source: src/AWS/Glacier/DescribeVault.ts

Runtime binding for the DescribeVault operation (IAM action glacier:DescribeVault on the vault ARN).

Reads the bound Vault’s description — archive count, total size in bytes, and last inventory date (both as of the last nightly inventory). Provide the implementation with Effect.provide(AWS.Glacier.DescribeVaultHttp).

const describeVault = yield* AWS.Glacier.DescribeVault(vault);
const { NumberOfArchives, SizeInBytes } = yield* describeVault();

Source: src/AWS/Glacier/GetJobOutput.ts

Runtime binding for the GetJobOutput operation (IAM action glacier:GetJobOutput on the vault ARN).

Downloads the output of a completed job on the bound Vault — the archive bytes for an archive-retrieval job, or the JSON inventory for an inventory-retrieval job. Supports ranged reads via the range header field for chunked downloads. Provide the implementation with Effect.provide(AWS.Glacier.GetJobOutputHttp).

const getJobOutput = yield* AWS.Glacier.GetJobOutput(vault);
const { body, status } = yield* getJobOutput({ jobId });

Source: src/AWS/Glacier/InitiateJob.ts

Runtime binding for the InitiateJob operation (IAM action glacier:InitiateJob on the vault ARN).

Initiates an archive-retrieval, inventory-retrieval, or select job against the bound Vault. Retrieval is asynchronous — poll the returned jobId with DescribeJob and fetch the result with GetJobOutput once it completes (typically 3–5 hours for standard tier, minutes for expedited). Provide the implementation with Effect.provide(AWS.Glacier.InitiateJobHttp).

const initiateJob = yield* AWS.Glacier.InitiateJob(vault);
const { jobId } = yield* initiateJob({
jobParameters: { Type: "inventory-retrieval" },
});

Source: src/AWS/Glacier/InitiateMultipartUpload.ts

Runtime binding for the InitiateMultipartUpload operation (IAM action glacier:InitiateMultipartUpload on the vault ARN).

Starts a multipart upload to the bound Vault and returns the uploadId to use with UploadMultipartPart and CompleteMultipartUpload. partSize must be a power-of-two multiple of 1 MiB (as a string of bytes). Provide the implementation with Effect.provide(AWS.Glacier.InitiateMultipartUploadHttp).

InitiateMultipartUpload: Uploading Archives

Section titled “InitiateMultipartUpload: Uploading Archives”
const initiateMultipartUpload =
yield* AWS.Glacier.InitiateMultipartUpload(vault);
const { uploadId } = yield* initiateMultipartUpload({
archiveDescription: "large backup",
partSize: String(8 * 1024 * 1024),
});

Source: src/AWS/Glacier/ListJobs.ts

Runtime binding for the ListJobs operation (IAM action glacier:ListJobs on the vault ARN).

Lists in-progress and recently finished jobs for the bound Vault, optionally filtered by status code or completion. Provide the implementation with Effect.provide(AWS.Glacier.ListJobsHttp).

const listJobs = yield* AWS.Glacier.ListJobs(vault);
const { JobList } = yield* listJobs({ completed: "true" });

Source: src/AWS/Glacier/ListMultipartUploads.ts

Runtime binding for the ListMultipartUploads operation (IAM action glacier:ListMultipartUploads on the vault ARN).

Lists the in-progress multipart uploads for the bound Vault — useful for finding and aborting stale uploads that still accrue storage. Provide the implementation with Effect.provide(AWS.Glacier.ListMultipartUploadsHttp).

const listMultipartUploads =
yield* AWS.Glacier.ListMultipartUploads(vault);
const { UploadsList } = yield* listMultipartUploads();

Source: src/AWS/Glacier/ListParts.ts

Runtime binding for the ListParts operation (IAM action glacier:ListParts on the vault ARN).

Lists the parts already uploaded for an in-progress multipart upload on the bound Vault, sorted by byte range — the resume point after a crashed uploader. Provide the implementation with Effect.provide(AWS.Glacier.ListPartsHttp).

const listParts = yield* AWS.Glacier.ListParts(vault);
const { Parts } = yield* listParts({ uploadId });

Source: src/AWS/Glacier/UploadArchive.ts

Runtime binding for the UploadArchive operation (IAM action glacier:UploadArchive on the vault ARN).

Uploads an archive to the bound Vault in a single request (up to 4 GiB; use the multipart bindings for larger archives). The response carries the new archiveId — Glacier has no list-archives API outside of inventory jobs, so persist it. Provide the implementation with Effect.provide(AWS.Glacier.UploadArchiveHttp).

const uploadArchive = yield* AWS.Glacier.UploadArchive(vault);
const { archiveId, checksum } = yield* uploadArchive({
archiveDescription: "nightly backup",
checksum: treeHash,
body: payload,
});

Source: src/AWS/Glacier/UploadMultipartPart.ts

Runtime binding for the UploadMultipartPart operation (IAM action glacier:UploadMultipartPart on the vault ARN).

Uploads one part of a multipart upload to the bound Vault. The range field carries the part’s byte range (e.g. bytes 0-8388607/*) and checksum its SHA-256 tree hash. Provide the implementation with Effect.provide(AWS.Glacier.UploadMultipartPartHttp).

const uploadMultipartPart = yield* AWS.Glacier.UploadMultipartPart(vault);
yield* uploadMultipartPart({
uploadId,
range: "bytes 0-8388607/*",
checksum: partTreeHash,
body: partBytes,
});

Source: src/AWS/Glacier/Vault.ts

An Amazon S3 Glacier vault — a container for archives in the original (vault-based) S3 Glacier service.

Vault creation is idempotent and free; storage is billed per archive. A vault must be empty to be deleted, which is always the case for vaults that only ever held configuration.

Basic Vault

import * as Glacier from "alchemy/AWS/Glacier";
const vault = yield* Glacier.Vault("Backups");

Vault with Tags

const vault = yield* Glacier.Vault("Backups", {
tags: { team: "storage" },
});
const topic = yield* SNS.Topic("VaultEvents");
const vault = yield* Glacier.Vault("Backups", {
notificationConfig: {
snsTopic: topic.topicArn,
events: ["ArchiveRetrievalCompleted", "InventoryRetrievalCompleted"],
},
});

Vault access policy

const vault = yield* Glacier.Vault("Backups", {
accessPolicy: {
Version: "2012-10-17",
Statement: [{
Sid: "deny-archive-deletes",
Effect: "Deny",
Principal: "*",
Action: ["glacier:DeleteArchive"],
Resource: ["arn:aws:glacier:us-east-1:123456789012:vaults/backups"],
}],
},
});

Vault lock policy (left in-progress, never completed)

const vault = yield* Glacier.Vault("Compliance", {
lockPolicy: {
Version: "2012-10-17",
Statement: [{
Sid: "deny-archive-deletes",
Effect: "Deny",
Principal: "*",
Action: ["glacier:DeleteArchive"],
Resource: ["arn:aws:glacier:us-east-1:123456789012:vaults/compliance"],
}],
},
});