# SubnetAttributes

- Source: [`aws-ec2/lib/vpc.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ec2/lib/vpc.ts#L912)

## Example

```ts
// Supply all properties
const subnet1 = ec2.Subnet.fromSubnetAttributes(this, 'SubnetFromAttributes', {
  subnetId: 's-1234',
  availabilityZone: 'pub-az-4465',
  routeTableId: 'rt-145'
});

// Supply only subnet id
const subnet2 = ec2.Subnet.fromSubnetId(this, 'SubnetFromId', 's-1234');
```

## Properties

- `availabilityZone`: string — The Availability Zone the subnet is located in.

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

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