Skip to content

VolumeAttachment

Source: src/AWS/EC2/VolumeAttachment.ts

Attaches an EBS Volume to an EC2 Instance at a device name. The volume and instance must be in the same Availability Zone. On delete the volume is detached (and force-detached as a fallback) before the resource is removed.

This is an existence-style resource — its identity is the volumeId/instanceId/device triple. Changing any of them replaces the attachment.

const attachment = yield* AWS.EC2.VolumeAttachment("DataAttachment", {
volumeId: volume.volumeId,
instanceId: instance.instanceId,
device: "/dev/sdf",
});

The volume appears to the instance as a block device at device. On modern Linux AMIs the kernel may rename /dev/sdf to /dev/xvdf — check lsblk inside the instance. The volume and instance must share an AZ.