CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-pulumi--aws

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources with infrastructure-as-code.

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

ebs.mddocs/storage/

EBS - Elastic Block Store

Amazon EBS provides block storage volumes for EC2 instances.

Common Tasks

Create an encrypted GP3 volume

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" },
});

Create a snapshot of a volume

import * as aws from "@pulumi/aws";

const snapshot = new aws.ebs.Snapshot("backup", {
    volumeId: volume.id,
    description: "Daily backup",
    tags: { Type: "automated-backup" },
});

Restore volume from snapshot

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" },
});

Core Resources

Volume

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"
    },
});

Snapshot

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 });

Volume Types

  • gp2/gp3 - General Purpose SSD (gp3 recommended for better price/performance)
  • io1/io2 - Provisioned IOPS SSD for high-performance databases
  • st1 - Throughput-optimized HDD for big data and log processing
  • sc1 - Cold HDD for infrequent access
  • standard - Magnetic volumes (legacy)

Best Practices

  • Enable encryption for sensitive data
  • Use GP3 volumes for better cost efficiency over GP2
  • Create regular snapshots for disaster recovery
  • Tag volumes with purpose and retention policies
  • Use appropriate volume type for workload characteristics

Related Services

  • EC2 - Attach EBS volumes to EC2 instances
  • Backup - Automate EBS snapshot lifecycle
  • KMS - Encrypt EBS volumes with custom keys
  • CloudWatch - Monitor volume performance metrics
  • EFS - Alternative file storage for shared access across instances

Install with Tessl CLI

npx tessl i tessl/npm-pulumi--aws@7.16.0

docs

index.md

quickstart.md

README.md

tile.json