Volume
Source:
src/AWS/EC2/Volume.ts
An Elastic Block Store (EBS) volume — durable block storage you attach to an
EC2 instance via a VolumeAttachment. Volumes live in a single
Availability Zone and persist independently of any instance.
Changing availabilityZone, encrypted, kmsKeyId, snapshotId, or
shrinking size replaces the volume. Growing size and changing iops,
throughput, or volumeType are applied in place via modifyVolume (note
AWS enforces a 6-hour cooldown between volume modifications).
Creating a Volume
Section titled “Creating a Volume”const volume = yield* AWS.EC2.Volume("DataVolume", { availabilityZone: "us-east-1a", size: 20, volumeType: "gp3",});The minimal volume: a 20 GiB general-purpose gp3 volume in one AZ. It must
be in the same AZ as the instance you attach it to.
Provisioned Performance
Section titled “Provisioned Performance”const fast = yield* AWS.EC2.Volume("FastVolume", { availabilityZone: "us-east-1a", size: 100, volumeType: "gp3", iops: 6000, throughput: 250,});gp3 decouples IOPS and throughput from size, so you can provision up to
16,000 IOPS and 1,000 MiB/s independently. Use io2 for the highest
durability and IOPS ceilings.
Encryption
Section titled “Encryption”const secure = yield* AWS.EC2.Volume("SecureVolume", { availabilityZone: "us-east-1a", size: 20, encrypted: true, kmsKeyId: "alias/my-app-key",});Setting kmsKeyId implies encryption. Omit it while setting encrypted: true to use the account’s default EBS KMS key.
Creating from a Snapshot
Section titled “Creating from a Snapshot”const restored = yield* AWS.EC2.Volume("RestoredVolume", { availabilityZone: "us-east-1a", snapshotId: snapshot.snapshotId,});When you create a volume from a snapshot, size defaults to the snapshot’s
size and can only be grown, never shrunk.