A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources with infrastructure-as-code.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Amazon S3 Glacier provides secure, durable, and low-cost storage for data archiving and long-term backup.
import * as aws from "@pulumi/aws";
const vault = new aws.glacier.Vault("archive-vault", {
name: "long-term-archives",
tags: { Purpose: "compliance" },
});import * as aws from "@pulumi/aws";
const vault = new aws.glacier.Vault("backup-vault", {
name: "backup-archives",
notification: {
snsTopic: snsTopic.arn,
events: ["ArchiveRetrievalCompleted", "InventoryRetrievalCompleted"],
},
tags: { Retention: "7-years" },
});import * as aws from "@pulumi/aws";
const lock = new aws.glacier.VaultLock("compliance-lock", {
vaultName: vault.name,
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Effect: "Deny",
Principal: "*",
Action: "glacier:DeleteArchive",
Resource: vault.arn,
Condition: {
NumericLessThan: {
"glacier:ArchiveAgeInDays": "2555" // ~7 years
}
}
}]
}),
completeLock: true,
});class Vault extends pulumi.CustomResource {
constructor(name: string, args?: VaultArgs, opts?: pulumi.CustomResourceOptions);
readonly arn: pulumi.Output<string>;
readonly name: pulumi.Output<string>;
}
interface VaultArgs {
name?: pulumi.Input<string>;
accessPolicy?: pulumi.Input<string>;
notification?: pulumi.Input<VaultNotification>;
tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
}
interface VaultNotification {
snsTopic: pulumi.Input<string>;
events: pulumi.Input<pulumi.Input<string>[]>;
}Example: Basic archive vault
const vault = new aws.glacier.Vault("data-archive", {
name: "company-data-archive",
tags: {
Department: "IT",
Compliance: "SOX",
RetentionYears: "7"
},
});Example: Vault with SNS notifications
// SNS topic for notifications
const topic = new aws.sns.Topic("glacier-notifications", {
displayName: "Glacier Archive Notifications",
});
// Vault with notifications enabled
const vault = new aws.glacier.Vault("backup-vault", {
name: "backup-archives",
notification: {
snsTopic: topic.arn,
events: [
"ArchiveRetrievalCompleted",
"InventoryRetrievalCompleted",
],
},
tags: {
Purpose: "automated-backups",
NotificationsEnabled: "true"
},
});Example: Vault with access policy
const vault = new aws.glacier.Vault("restricted-vault", {
name: "secure-archives",
accessPolicy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Effect: "Allow",
Principal: {
AWS: backupRoleArn
},
Action: [
"glacier:InitiateJob",
"glacier:GetJobOutput",
"glacier:UploadArchive"
],
Resource: pulumi.interpolate`arn:aws:glacier:${region}:${accountId}:vaults/secure-archives`
}]
}),
tags: {
AccessControl: "restricted",
Environment: "production"
},
});class VaultLock extends pulumi.CustomResource {
constructor(name: string, args: VaultLockArgs, opts?: pulumi.CustomResourceOptions);
}
interface VaultLockArgs {
vaultName: pulumi.Input<string>;
policy: pulumi.Input<string>;
completeLock?: pulumi.Input<boolean>;
ignoreDeletionError?: pulumi.Input<boolean>;
}Example: Compliance vault lock (7-year retention)
const lock = new aws.glacier.VaultLock("compliance-lock", {
vaultName: vault.name,
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Sid: "deny-deletion-before-retention",
Effect: "Deny",
Principal: "*",
Action: "glacier:DeleteArchive",
Resource: vault.arn,
Condition: {
NumericLessThan: {
"glacier:ArchiveAgeInDays": "2555" // 7 years
}
}
}]
}),
completeLock: true, // Immutable after completion
});Example: Test vault lock before completing
// First, test the lock policy
const testLock = new aws.glacier.VaultLock("test-lock", {
vaultName: vault.name,
policy: lockPolicyJson,
completeLock: false, // Test mode - can be aborted
});
// After testing (usually 24 hours), complete the lock
const finalLock = new aws.glacier.VaultLock("final-lock", {
vaultName: vault.name,
policy: lockPolicyJson,
completeLock: true, // Permanently lock
});Example: Multi-condition vault lock
const advancedLock = new aws.glacier.VaultLock("advanced-lock", {
vaultName: vault.name,
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [
{
Sid: "deny-early-deletion",
Effect: "Deny",
Principal: "*",
Action: "glacier:DeleteArchive",
Resource: vault.arn,
Condition: {
NumericLessThan: {
"glacier:ArchiveAgeInDays": "365"
}
}
},
{
Sid: "require-mfa-for-deletion",
Effect: "Deny",
Principal: "*",
Action: "glacier:DeleteArchive",
Resource: vault.arn,
Condition: {
BoolIfExists: {
"aws:MultiFactorAuthPresent": "false"
}
}
}
]
}),
completeLock: true,
});Glacier offers different storage classes via S3:
Install with Tessl CLI
npx tessl i tessl/npm-pulumi--aws