Skip to content
v2.277.0

Experimental

@aws-cdk/aws-ec2-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

SubnetV2Attributes Struct ​

Properties required to import a subnet.

Example ​

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
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
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());
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
});
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 ​

availabilityZonestringavailability_zonestravailabilityZoneStringAvailabilityZonestringAvailabilityZone*stringrequired#
The Availability Zone this subnet is located in.

Default: No AZ information, cannot use AZ selection features

ipv4CidrBlockstringipv4_cidr_blockstripv4CidrBlockStringIpv4CidrBlockstringIpv4CidrBlock*stringrequired#
The IPv4 CIDR block associated with the subnet.

Default: No CIDR information, cannot use CIDR filter features

ipv6CidrBlockoptionalstringipv6_cidr_blockoptionalstripv6CidrBlockoptionalStringIpv6CidrBlockoptionalstringIpv6CidrBlockoptional*string#
The IPv4 CIDR block associated with the subnet.

Default: No CIDR information, cannot use CIDR filter features

routeTableIdoptionalstringroute_table_idoptionalstrrouteTableIdoptionalStringRouteTableIdoptionalstringRouteTableIdoptional*string#
The ID of the route table for this particular subnet.

Default: No route table information, cannot create VPC endpoints

subnetIdstringsubnet_idstrsubnetIdStringSubnetIdstringSubnetId*stringrequired#
The subnetId for this particular subnet.
subnetNameoptionalstringsubnet_nameoptionalstrsubnetNameoptionalStringSubnetNameoptionalstringSubnetNameoptional*string#
Name of the given subnet.

Default: no subnet name

subnetTypeSubnetTypesubnet_typeSubnetTypesubnetTypeSubnetTypeSubnetTypeSubnetTypeSubnetTypeSubnetTyperequired#
The type of subnet (public or private) that this subnet represents.