Is it possible to add an entry to an imported private subnet's route table with CDK in typescript? I'm importing the VPC with:
import ec2 = require('@aws-cdk/aws-ec2');
vpc = ec2.Vpc.fromVpcAttributes(...)
(docs on fromVpcAttributes
: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.Vpc.html#static-from-wbr-vpc-wbr-attributesscope-id-attrs), and its private subnets are therefore being imported as an array of ISubnet
s. I want to set up VPC Peering targets/destinations in each of these private subnets' route tables, and the most common way to do this seems to be via the Subnet
's addRoute
method (https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.Subnet.html#add-wbr-routeid-options). This works when the subnets are newly made, such as here: https://qiita.com/is_ryo/items/66dfe6c4b6dda4bd1eeb, but my private subnets don't have this method, since they were imported as ISubnet
s. Is there a way to import these subnets as Subnets instead? Or, a better way to add entries in this case?