Skip to content
v2.278.0

CfnVolumeAttachmentProps Struct ​

Properties for defining a CfnVolumeAttachment.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const cfnVolumeAttachmentProps: ec2.CfnVolumeAttachmentProps = {
  instanceId: 'instanceId',
  volumeId: 'volumeId',

  // the properties below are optional
  device: 'device',
  ebsCardIndex: 123,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

cfn_volume_attachment_props = ec2.CfnVolumeAttachmentProps(
    instance_id="instanceId",
    volume_id="volumeId",

    # the properties below are optional
    device="device",
    ebs_card_index=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;

CfnVolumeAttachmentProps cfnVolumeAttachmentProps = CfnVolumeAttachmentProps.builder()
        .instanceId("instanceId")
        .volumeId("volumeId")

        // the properties below are optional
        .device("device")
        .ebsCardIndex(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

var cfnVolumeAttachmentProps = new CfnVolumeAttachmentProps {
    InstanceId = "instanceId",
    VolumeId = "volumeId",

    // the properties below are optional
    Device = "device",
    EbsCardIndex = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnVolumeAttachmentProps := &CfnVolumeAttachmentProps{
	InstanceId: jsii.String("instanceId"),
	VolumeId: jsii.String("volumeId"),

	// the properties below are optional
	Device: jsii.String("device"),
	EbsCardIndex: jsii.Number(123),
}

Properties ​

deviceoptionalstringdeviceoptionalstrdeviceoptionalStringDeviceoptionalstringDeviceoptional*string #
The device name (for example, `/dev/sdh` or `xvdh` ).
ebsCardIndexoptionalnumberebs_card_indexoptionalint | floatebsCardIndexoptionalNumberEbsCardIndexoptionaldoubleEbsCardIndexoptional*float64 #
The index of the EBS card.

Some instance types support multiple EBS cards. The default EBS card index is 0.

instanceIdstring | IInstanceRefinstance_idtyping.Union[str, IInstanceRef]instanceIdStringInstanceIdstringInstanceIdinterface{} required #
The ID of the instance to which the volume attaches.

This value can be a reference to an AWS::EC2::Instance resource, or it can be the physical ID of an existing EC2 instance.

volumeIdstring | IVolumeRefvolume_idtyping.Union[str, IVolumeRef]volumeIdStringVolumeIdstringVolumeIdinterface{} required #
The ID of the Amazon EBS volume.
notes

The volume and instance must be within the same Availability Zone. This value can be a reference to an AWS::EC2::Volume resource, or it can be the volume ID of an existing Amazon EBS volume.