Skip to content
v2.278.0

VolumeAttributes Struct ​

Attributes required to import an existing EBS Volume into the Stack.

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';
import { aws_kms as kms } from 'aws-cdk-lib';

declare const key: kms.Key;
const volumeAttributes: ec2.VolumeAttributes = {
  availabilityZone: 'availabilityZone',
  volumeId: 'volumeId',

  // the properties below are optional
  encryptionKey: key,
};
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
from aws_cdk import aws_kms as kms

# key: kms.Key

volume_attributes = ec2.VolumeAttributes(
    availability_zone="availabilityZone",
    volume_id="volumeId",

    # the properties below are optional
    encryption_key=key
)
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.*;
import software.amazon.awscdk.services.kms.*;

Key key;

VolumeAttributes volumeAttributes = VolumeAttributes.builder()
        .availabilityZone("availabilityZone")
        .volumeId("volumeId")

        // the properties below are optional
        .encryptionKey(key)
        .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;
using Amazon.CDK.AWS.KMS;

Key key;

var volumeAttributes = new VolumeAttributes {
    AvailabilityZone = "availabilityZone",
    VolumeId = "volumeId",

    // the properties below are optional
    EncryptionKey = key
};
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"
import "github.com/aws/aws-cdk-go/awscdk"

var key Key

volumeAttributes := &VolumeAttributes{
	AvailabilityZone: jsii.String("availabilityZone"),
	VolumeId: jsii.String("volumeId"),

	// the properties below are optional
	EncryptionKey: key,
}

Properties ​

availabilityZonestringavailability_zonestravailabilityZoneStringAvailabilityZonestringAvailabilityZone*string required #
The availability zone that the EBS Volume is contained within (ex: us-west-2a).
encryptionKeyoptionalIKeyencryption_keyoptionalIKeyencryptionKeyoptionalIKeyEncryptionKeyoptionalIKeyEncryptionKeyoptionalIKey #
The customer-managed encryption key that is used to encrypt the Volume.

Default: None -- The EBS Volume is not using a customer-managed KMS key for encryption.

volumeIdstringvolume_idstrvolumeIdStringVolumeIdstringVolumeId*string required #
The EBS Volume's ID.