Skip to main content

glacier-upload

pre-commit pypi License-GPLv3

A helper tool to upload and manage archives in Amazon S3 Glacier Vaults. Amazon S3 Glacier is a cloud storage service that is optimized for long term storage for a relatively cheap price. NOT to be confused with Amazon S3 with Glacier (Instant Retrieval, Flexible Retrieval, and Deep Archive) tier storage, which uses the S3 API and does not deal with vaults and archives.

Installation

Minimum required Python version is 3.9. To install, run this in your terminal:

$ pip install glacier_upload

Usage

Prerequisites

To upload an archive to Amazon S3 Glacier vault, ensure you have:

  • Created an AWS account
  • Created an Amazon S3 Glacier vault from the AWS CLI tool or the Management Console

Uploading an archive

An upload can be performed by running glacier upload followed by the vault name and the file name(s) that you want to upload.

glacier upload VAULT_NAME FILE_NAME [FILE_NAME ...]

FILE_NAME can be one or more files or directories.

The script will:

  1. Read the file(s)
  2. Consolidate them into a .tar.xz archive if multiple FILE_NAMEs are specified or FILE_NAME is one or more directories
  3. Upload the file in one go if the file is less than 100 MB in size, or
  4. Split the file into chunks
  5. Spawn a number of threads that will upload the chunks in parallel. Note that it will not read the entire file into memory, but only parts of the file as it processes the chunks.
  6. Return the archive ID when complete. Consider saving this archive ID in a safe place for retrieval purposes, because Amazon Glacier does not provide a list of archives in realtime. See the "Requesting an inventory" section below for details.

There are additional options to customize your upload, such as adding a description to the archive or configuring the number of threads or the size of parts. Run glacier upload --help for more information.

If a multipart upload is interrupted in the middle (because of an exception, interrupted manually, or other reason), the script will show you the upload ID. That upload ID can be used to resume the upload, using the same command but adding the --upload-id option, like so:

glacier upload --upload-id UPLOAD_ID VAULT_NAME FILE_NAME [FILE_NAME ...]

Retrieving an archive

Retrieving an archive in glacier requires two steps. First, initiate a "retrieval job" using:

glacier archive init-retrieval VAULT_NAME ARCHIVE_ID

To see a list of archive IDs in a vault, see "Requesting an inventory" below.

Then, the retrieval job will take some time to complete. Run the next step to both check whether the job is complete and retrieve the archive if it has been completed.

glacier archive get VAULT_NAME JOB_ID FILE_NAME

Requesting an inventory

Vaults do not provide realtime access to a list of their contents. To know what a vault contains, you need to request an inventory of the archive, in a similar manner to retrieving an archive. To initiate an inventory, run:

glacier inventory init-retrieval VAULT_NAME

Then, the inventory job will take some time to complete. Run the next step to both check whether the job is complete and retrieve the inventory if it has been completed.

glacier inventory get VAULT_NAME JOB_ID

Deleting an archive, deleting an upload job, creating/deleting a vault, etc.

All jobs other than uploading an archive and requesting/downloading an inventory or archive can be done using the AWS CLI. Those functionalities are not implemented here to avoid duplication of work, and minimize maintenance efforts of this package.

Contributing

Contributions and/or bug fixes are welcome! Just make sure you've read the below requirements, then feel free to fork, make a topic branch, make your changes, and submit a PR.

Development Requirements

Before committing to this repo, install poetry on your local machine, then run these commands to setup your environment:

poetry install
pre-commit install

All code is formatted with black. Consider installing an integration for it in your favourite text editor.

Metadata

Release files for glacier-upload 2.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glacier-upload 2.1.2
File Size Uploaded
glacier_upload-2.1.2.tar.gz 22.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for glacier-upload 2.1.2
File Interpreter ABI Platform
glacier_upload-2.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 48.2 kB

Release files / glacier_upload-2.1.2.tar.gz

Download URL glacier_upload-2.1.2.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c20a130cb2f6737ada8fa0f4d087c882b9a1e5398caa37fca9ebd2fdbb76603c
BLAKE2b-256 checksum
How to use checksums
d6999b20add185d7d969b3e278f5346769342b99c4497bc5f3181af7a205e8d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure

Release files / glacier_upload-2.1.2-py3-none-any.whl

Download URL glacier_upload-2.1.2-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6dbcebd15ba1c3386df3dab927c0422e448dd60ca05f0083d38a141aa36728b3
BLAKE2b-256 checksum
How to use checksums
2d9dffbf69d21b2d4fb8c5d78544565fbc822c7ef7785c6188de7dcae7d085cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

2.1.2 This release

2 release files

2.1.1

2 release files

2.1

2 release files

2.0

2 release files

1.2

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page