1. Answers
  2. Archiving AWS FSx to Glacier - A How-To Guide

How do I archive AWS FSx to Glacier?

In this guide, we will walk through the steps to create an AWS FSx file system and set up a lifecycle policy to archive data to Glacier. We will use Pulumi to define and manage our infrastructure as code.

Key Points

  1. AWS FSx File System: We will create an FSx file system, which is a fully managed file storage service optimized for various workloads.
  2. Lifecycle Policy: We will configure an S3 bucket with a lifecycle policy to transition data to Glacier for long-term storage.

Steps

  1. Create an S3 Bucket: This bucket will be used to store backups of the FSx file system.
  2. Create a Lifecycle Policy: This policy will automatically transition objects in the S3 bucket to Glacier after a specified period.
  3. Create an FSx File System: This file system will be configured to use the S3 bucket for backups.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// Create an S3 bucket to store FSx backups
const backupBucket = new aws.s3.Bucket("backupBucket", {
    versioning: {
        enabled: true,
    },
    lifecycleRules: [{
        enabled: true,
        transitions: [{
            days: 30, // Transition objects to Glacier after 30 days
            storageClass: "GLACIER",
        }],
    }],
});

// Create an FSx file system
const fsxFileSystem = new aws.fsx.WindowsFileSystem("fsxFileSystem", {
    storageCapacity: 300,
    subnetIds: ["subnet-12345678"], // Replace with your subnet ID
    securityGroupIds: ["sg-12345678"], // Replace with your security group ID
    throughputCapacity: 8,
    weeklyMaintenanceStartTime: "1:05:00",
    dailyAutomaticBackupStartTime: "05:00",
    automaticBackupRetentionDays: 7,
    copyTagsToBackups: true,
    kmsKeyId: "arn:aws:kms:us-west-2:123456789012:key/abcd1234-12ab-34cd-56ef-1234567890ab", // Replace with your KMS Key ID
    backupId: backupBucket.id,
});

// Export the S3 bucket name and FSx file system ID
export const bucketName = backupBucket.id;
export const fileSystemId = fsxFileSystem.id;

Summary

In this guide, we created an AWS FSx file system and configured it to back up to an S3 bucket. We also set up a lifecycle policy on the S3 bucket to automatically transition objects to Glacier after 30 days. This setup ensures that your data is efficiently archived for long-term storage, reducing costs while maintaining accessibility.

Deploy this code

Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.

Sign up

New to Pulumi?

Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.

Sign up