SubnetAttributes Struct
| Source | aws-ec2/lib/vpc.ts |
|---|
Example
java
// Supply all properties
ISubnet subnet1 = Subnet.fromSubnetAttributes(this, "SubnetFromAttributes", SubnetAttributes.builder()
.subnetId("s-1234")
.availabilityZone("pub-az-4465")
.routeTableId("rt-145")
.build());
// Supply only subnet id
ISubnet subnet2 = Subnet.fromSubnetId(this, "SubnetFromId", "s-1234");
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Supply all properties
var subnet1 = Subnet.FromSubnetAttributes(this, "SubnetFromAttributes", new SubnetAttributes {
SubnetId = "s-1234",
AvailabilityZone = "pub-az-4465",
RouteTableId = "rt-145"
});
// Supply only subnet id
var subnet2 = Subnet.FromSubnetId(this, "SubnetFromId", "s-1234");
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Supply all properties
subnet1 := ec2.Subnet_FromSubnetAttributes(this, jsii.String("SubnetFromAttributes"), &SubnetAttributes{
SubnetId: jsii.String("s-1234"),
AvailabilityZone: jsii.String("pub-az-4465"),
RouteTableId: jsii.String("rt-145"),
})
// Supply only subnet id
subnet2 := ec2.Subnet_FromSubnetId(this, jsii.String("SubnetFromId"), jsii.String("s-1234"))
Properties
availabilityZoneoptionalstringavailability_zoneoptionalstravailabilityZoneoptionalStringAvailabilityZoneoptionalstringAvailabilityZoneoptional*string #The Availability Zone the subnet is located in.
Default: No AZ information, cannot use AZ selection features
ipv4CidrBlockoptionalstringipv4_cidr_blockoptionalstripv4CidrBlockoptionalStringIpv4CidrBlockoptionalstringIpv4CidrBlockoptional*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
The subnetId for this particular subnet.