# RequestedSubnet

Subnet requested for allocation.

- Source: [`aws-ec2/lib/ip-addresses.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ec2/lib/ip-addresses.ts#L95)
- Type last changed: v2.48.0 · 27 Oct 2022

## 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';
const requestedSubnet: ec2.RequestedSubnet = {
  availabilityZone: 'availabilityZone',
  configuration: {
    name: 'name',
    subnetType: ec2.SubnetType.PRIVATE_ISOLATED,

    // the properties below are optional
    cidrMask: 123,
    ipv6AssignAddressOnCreation: false,
    mapPublicIpOnLaunch: false,
    reserved: false,
  },
  subnetConstructId: 'subnetConstructId',
};
```

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

requested_subnet = ec2.RequestedSubnet(
    availability_zone="availabilityZone",
    configuration=ec2.SubnetConfiguration(
        name="name",
        subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,

        # the properties below are optional
        cidr_mask=123,
        ipv6_assign_address_on_creation=False,
        map_public_ip_on_launch=False,
        reserved=False
    ),
    subnet_construct_id="subnetConstructId"
)
```

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.*;

RequestedSubnet requestedSubnet = RequestedSubnet.builder()
        .availabilityZone("availabilityZone")
        .configuration(SubnetConfiguration.builder()
                .name("name")
                .subnetType(SubnetType.PRIVATE_ISOLATED)

                // the properties below are optional
                .cidrMask(123)
                .ipv6AssignAddressOnCreation(false)
                .mapPublicIpOnLaunch(false)
                .reserved(false)
                .build())
        .subnetConstructId("subnetConstructId")
        .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;

var requestedSubnet = new RequestedSubnet {
    AvailabilityZone = "availabilityZone",
    Configuration = new SubnetConfiguration {
        Name = "name",
        SubnetType = SubnetType.PRIVATE_ISOLATED,

        // the properties below are optional
        CidrMask = 123,
        Ipv6AssignAddressOnCreation = false,
        MapPublicIpOnLaunch = false,
        Reserved = false
    },
    SubnetConstructId = "subnetConstructId"
};
```

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"

requestedSubnet := &RequestedSubnet{
	AvailabilityZone: jsii.String("availabilityZone"),
	Configuration: &SubnetConfiguration{
		Name: jsii.String("name"),
		SubnetType: awscdk.Aws_ec2.SubnetType_PRIVATE_ISOLATED,

		// the properties below are optional
		CidrMask: jsii.Number(123),
		Ipv6AssignAddressOnCreation: jsii.Boolean(false),
		MapPublicIpOnLaunch: jsii.Boolean(false),
		Reserved: jsii.Boolean(false),
	},
	SubnetConstructId: jsii.String("subnetConstructId"),
}
```

## Properties

- `availabilityZone`: string (required) — The availability zone for the subnet.

- `configuration`: [SubnetConfiguration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetConfiguration.html) (required) — Specify configuration parameters for a single subnet group in a VPC.

- `subnetConstructId`: string (required) — Id for the Subnet construct.
