> **Experimental**
>
> `@aws-cdk/aws-ec2-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# SubnetV2Attributes

Properties required to import a subnet.

Used as argument in: [SubnetV2.fromSubnetV2Attributes](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-ec2-alpha.SubnetV2.html#fromsubnetv2attributes)

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/subnet-v2.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts#L417)

## Example

TypeScript:

```ts
SubnetV2.fromSubnetV2Attributes(this, 'ImportedSubnet', {
  subnetId: 'subnet-0123456789abcdef0',
  availabilityZone: 'us-west-2a',
  ipv4CidrBlock: '10.2.0.0/24',
  routeTableId: 'rtb-0871c310f98da2cbb',
  subnetType: SubnetType.PRIVATE_ISOLATED,
});
```

Python:

```python
SubnetV2.from_subnet_v2_attributes(self, "ImportedSubnet",
    subnet_id="subnet-0123456789abcdef0",
    availability_zone="us-west-2a",
    ipv4_cidr_block="10.2.0.0/24",
    route_table_id="rtb-0871c310f98da2cbb",
    subnet_type=SubnetType.PRIVATE_ISOLATED
)
```

Java:

```java
SubnetV2.fromSubnetV2Attributes(this, "ImportedSubnet", SubnetV2Attributes.builder()
        .subnetId("subnet-0123456789abcdef0")
        .availabilityZone("us-west-2a")
        .ipv4CidrBlock("10.2.0.0/24")
        .routeTableId("rtb-0871c310f98da2cbb")
        .subnetType(SubnetType.PRIVATE_ISOLATED)
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.ec2.Alpha
SubnetV2.FromSubnetV2Attributes(this, "ImportedSubnet", new SubnetV2Attributes {
    SubnetId = "subnet-0123456789abcdef0",
    AvailabilityZone = "us-west-2a",
    Ipv4CidrBlock = "10.2.0.0/24",
    RouteTableId = "rtb-0871c310f98da2cbb",
    SubnetType = SubnetType.PRIVATE_ISOLATED
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsec2alpha/v2
awsec2alpha.SubnetV2_FromSubnetV2Attributes(this, jsii.String("ImportedSubnet"), &SubnetV2Attributes{
	SubnetId: jsii.String("subnet-0123456789abcdef0"),
	AvailabilityZone: jsii.String("us-west-2a"),
	Ipv4CidrBlock: jsii.String("10.2.0.0/24"),
	RouteTableId: jsii.String("rtb-0871c310f98da2cbb"),
	SubnetType: awscdk.SubnetType_PRIVATE_ISOLATED,
})
```

## Properties

- `availabilityZone`: string (required) — The Availability Zone this subnet is located in.

  **Default:** No AZ information, cannot use AZ selection features

- `ipv4CidrBlock`: string (required) — The IPv4 CIDR block associated with the subnet.

  **Default:** No CIDR information, cannot use CIDR filter features

- `ipv6CidrBlock`: string — The IPv4 CIDR block associated with the subnet.

  **Default:** No CIDR information, cannot use CIDR filter features

- `routeTableId`: string — The ID of the route table for this particular subnet.

  **Default:** No route table information, cannot create VPC endpoints

- `subnetId`: string (required) — The subnetId for this particular subnet.

- `subnetName`: string — Name of the given subnet.

  **Default:** no subnet name

- `subnetType`: [SubnetType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetType.html) (required) — The type of subnet (public or private) that this subnet represents.
