# VolumeAttributes

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

Used as argument in: [Volume.fromVolumeAttributes](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Volume.html#fromvolumeattributes)

- Source: [`aws-ec2/lib/volume.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ec2/lib/volume.ts#L520)

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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
};
```

Golang:

```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

- `availabilityZone`: string (required) — The availability zone that the EBS Volume is contained within (ex: us-west-2a).

- `encryptionKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — 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.

- `volumeId`: string (required) — The EBS Volume's ID.
