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 EBS provides block storage volumes for EC2 instances.
import * as aws from "@pulumi/aws";
const volume = new aws.ebs.Volume("data-volume", {
availabilityZone: "us-east-1a",
size: 100, // GB
type: "gp3",
encrypted: true,
tags: { Name: "data-volume" },
});import * as aws from "@pulumi/aws";
const snapshot = new aws.ebs.Snapshot("backup", {
volumeId: volume.id,
description: "Daily backup",
tags: { Type: "automated-backup" },
});import * as aws from "@pulumi/aws";
const restored = new aws.ebs.Volume("restored-volume", {
availabilityZone: "us-east-1a",
snapshotId: snapshot.id,
type: "gp3",
tags: { Name: "restored-from-snapshot" },
});class Volume extends pulumi.CustomResource {
constructor(name: string, args: VolumeArgs, opts?: pulumi.CustomResourceOptions);
readonly arn: pulumi.Output<string>;
readonly id: pulumi.Output<string>;
}
interface VolumeArgs {
availabilityZone: pulumi.Input<string>;
size?: pulumi.Input<number>;
type?: pulumi.Input<"standard" | "gp2" | "gp3" | "io1" | "io2" | "sc1" | "st1">;
iops?: pulumi.Input<number>;
encrypted?: pulumi.Input<boolean>;
kmsKeyId?: pulumi.Input<string>;
snapshotId?: pulumi.Input<string>;
tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
}Example: Create high-performance IOPS volume
const highPerf = new aws.ebs.Volume("db-volume", {
availabilityZone: "us-east-1a",
size: 500,
type: "io2",
iops: 10000,
encrypted: true,
kmsKeyId: kmsKey.id,
tags: {
Name: "database-volume",
Environment: "production"
},
});Example: Create throughput-optimized volume
const throughput = new aws.ebs.Volume("log-volume", {
availabilityZone: "us-east-1a",
size: 1000,
type: "st1", // Throughput-optimized HDD
tags: {
Name: "log-storage",
Purpose: "streaming"
},
});class Snapshot extends pulumi.CustomResource {
constructor(name: string, args: SnapshotArgs, opts?: pulumi.CustomResourceOptions);
}
interface SnapshotArgs {
volumeId: pulumi.Input<string>;
description?: pulumi.Input<string>;
tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
}Example: Create tagged snapshot
const snapshot = new aws.ebs.Snapshot("daily-backup", {
volumeId: volume.id,
description: `Backup from ${new Date().toISOString()}`,
tags: {
Frequency: "daily",
RetentionDays: "30",
Environment: "production"
},
});Example: Cross-region snapshot copy
// Create snapshot in primary region
const primarySnapshot = new aws.ebs.Snapshot("primary-backup", {
volumeId: volume.id,
description: "Primary region backup",
});
// Copy to secondary region for DR
const drProvider = new aws.Provider("dr-region", {
region: "us-west-2",
});
const drSnapshot = new aws.ebs.SnapshotCopy("dr-backup", {
sourceSnapshotId: primarySnapshot.id,
sourceRegion: "us-east-1",
description: "DR backup copy",
}, { provider: drProvider });Install with Tessl CLI
npx tessl i tessl/npm-pulumi--aws