Skip to content

Reference External EBS Variables

Define EBS Volumes

Define the volumes attribute of the EBS variable to create EBS volumes independently from any particular instance. These volumes can be created without being attached to an instance. They can then be attached and detached as needed.

ebs = {
    volumes = {
        externaldiska = {
            availability_zone = "us-west-2a"
            size = 80
        }
        externaldiskb = {
            availability_zone = "us-west-2a"
            size = 80
        }
    }
}

Attach EBS Volumes to Instances

Use the external_disk attribute to attach one of the external EBS volumes to a VM. The EBS volume must be in the same availability zone as the instance to be attached.

odb = {
    names = [
        "tstodb"
    ]
    root_block_device = {
            volume_size = 100
            volume_type = "io2"
            iops = "3000"
        }
    disks = {
        disk1 = {
            device_name = "/dev/sdb"
            size = 60
        },
        disk2 = {
            device_name = "/dev/sdc"
            external_disk = "externaldiska"
        }
    }
}

See the output from the ebs_volume module here for an example of how the keys from the returned map appear for the different types of storage configurations.