aws-cdk-lib.aws_ec2.SubnetAttributes

interface SubnetAttributes

LanguageType name
.NETAmazon.CDK.AWS.EC2.SubnetAttributes
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#SubnetAttributes
Javasoftware.amazon.awscdk.services.ec2.SubnetAttributes
Pythonaws_cdk.aws_ec2.SubnetAttributes
TypeScript (source)aws-cdk-lib » aws_ec2 » SubnetAttributes

Example

// 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

NameTypeDescription
subnetIdstringThe subnetId for this particular subnet.
availabilityZone?stringThe Availability Zone the subnet is located in.
ipv4CidrBlock?stringThe IPv4 CIDR block associated with the subnet.
routeTableId?stringThe ID of the route table for this particular subnet.

subnetId

Type: string

The subnetId for this particular subnet.


availabilityZone?

Type: string (optional, default: No AZ information, cannot use AZ selection features)

The Availability Zone the subnet is located in.


ipv4CidrBlock?

Type: string (optional, default: No CIDR information, cannot use CIDR filter features)

The IPv4 CIDR block associated with the subnet.


routeTableId?

Type: string (optional, default: No route table information, cannot create VPC endpoints)

The ID of the route table for this particular subnet.