Swiftorial Logo
Home
Swift Lessons
Tutorials
Learn More
Career
Resources

AWS Glacier Basics

What is Amazon S3 Glacier?

Amazon S3 Glacier is a secure, durable, and low-cost storage service for data archiving and long-term backup. It is designed to store data that is infrequently accessed and requires retrieval times ranging from a few minutes to several hours.

Key Glacier Concepts

  • Vault: A container for storing archives in Amazon S3 Glacier. Each vault has a unique name within a region.
  • Archive: The data you store in a vault. An archive can be any data, such as photos, videos, or documents.
  • Job: A Glacier operation to retrieve an archive or a list of vault inventory. Jobs can take a few minutes to several hours to complete.
  • Retrieval Options: Options for retrieving data from Glacier, including Expedited, Standard, and Bulk retrievals.

Creating a Glacier Vault

To create a Glacier vault:

  1. Sign in to the AWS Management Console.
  2. Navigate to the Amazon S3 Glacier Dashboard.
  3. Click "Create vault".
  4. Enter a name for your vault and choose the AWS region where you want to create the vault.
  5. Click "Create vault".

Example: Creating a Glacier Vault

Let's create a Glacier vault:

Step-by-Step Example:

  1. Sign in to the AWS Management Console.
  2. Navigate to the Amazon S3 Glacier Dashboard and click "Create vault".
  3. Enter a name for your vault (e.g., "MyGlacierVault") and choose the AWS region (e.g., US East (N. Virginia)).
  4. Click "Create vault".

Uploading Archives to a Glacier Vault

To upload archives to a Glacier vault:

  1. Sign in to the AWS Management Console.
  2. Navigate to the Amazon S3 Glacier Dashboard.
  3. Click on the vault you created (e.g., "MyGlacierVault").
  4. Click "Upload archive".
  5. Choose the upload method. You can use the AWS Management Console, AWS CLI, or SDKs. For this example, we will use the AWS CLI.
  6. Use the AWS CLI command aws glacier upload-archive to upload an archive:
    aws glacier upload-archive --account-id - --vault-name MyGlacierVault --archive-description "My first archive" --body /path/to/file

Example: Uploading an Archive Using AWS CLI

Let's upload an archive to the "MyGlacierVault" vault using AWS CLI:

Step-by-Step Example:

  1. Ensure that the AWS CLI is installed and configured with your credentials.
  2. Open a terminal or command prompt.
  3. Run the following command to upload an archive:
    aws glacier upload-archive --account-id - --vault-name MyGlacierVault --archive-description "My first archive" --body /path/to/file

Retrieving Archives from a Glacier Vault

To retrieve archives from a Glacier vault:

  1. Sign in to the AWS Management Console.
  2. Navigate to the Amazon S3 Glacier Dashboard.
  3. Click on the vault you created (e.g., "MyGlacierVault").
  4. Click "Initiate job" and choose "Retrieve an archive".
  5. Enter the archive ID and choose the retrieval option (Expedited, Standard, or Bulk).
  6. Click "Initiate job" to start the retrieval process.

Example: Retrieving an Archive Using AWS CLI

Let's retrieve an archive from the "MyGlacierVault" vault using AWS CLI:

Step-by-Step Example:

  1. Ensure that the AWS CLI is installed and configured with your credentials.
  2. Open a terminal or command prompt.
  3. Run the following command to initiate a retrieval job:
    aws glacier initiate-job --account-id - --vault-name MyGlacierVault --job-parameters '{"Type": "archive-retrieval", "ArchiveId": "YOUR_ARCHIVE_ID", "Description": "Retrieve my archive"}'
  4. Check the status of the job using the command:
    aws glacier describe-job --account-id - --vault-name MyGlacierVault --job-id YOUR_JOB_ID

Monitoring and Managing Glacier Vaults

You can monitor and manage your Glacier vaults using the AWS Management Console, AWS CLI, or SDKs:

  • View Vault Inventory: Retrieve a list of archives stored in a vault.
  • Delete Vaults: Remove a vault that no longer contains any archives.
  • Configure Vault Notifications: Set up SNS notifications to receive updates on vault operations.

Example: Viewing Vault Inventory Using AWS CLI

Let's view the inventory of the "MyGlacierVault" vault using AWS CLI:

Step-by-Step Example:

  1. Ensure that the AWS CLI is installed and configured with your credentials.
  2. Open a terminal or command prompt.
  3. Run the following command to initiate an inventory retrieval job:
    aws glacier initiate-job --account-id - --vault-name MyGlacierVault --job-parameters '{"Type": "inventory-retrieval", "Description": "Retrieve vault inventory"}'
  4. Check the status of the job using the command:
    aws glacier describe-job --account-id - --vault-name MyGlacierVault --job-id YOUR_JOB_ID
  5. Once the job is complete, download the inventory using the command:
    aws glacier get-job-output --account-id - --vault-name MyGlacierVault --job-id YOUR_JOB_ID output.json

Conclusion

Amazon S3 Glacier is a cost-effective solution for long-term data archiving and backup. By understanding the basics of Glacier, including how to create vaults, upload and retrieve archives, and monitor vaults, you can effectively use Glacier to securely store your infrequently accessed data.