This message was deleted.
# aws
s
This message was deleted.
v
I think that it is handled in the code here, but not sure when it is called. When I debugged it, I could not trace the
super()
call.
b
hey there, not sure I'm following. You have an existing VPC, and you're using
awsx.ec2.Vpc.fromExistingIds
and you passed in the subnet ids, and now you want to grab the subnets from the
const vpc = awsx.ec2.Vpc.fromExistingIds
right? is there a reason you wouldn't just get the subnets from the
publicSubnetIds
you already passed in?
v
Hi! My goal there is to grab the associated route table IDs and create a route in them to do VPC peering. Since
awsx.ec2.Subnet
has a
routeTable
attribute, it was an easy task. I was wondering if I could do the same with the
awsx.ec2.Vpc
object created using
awsx.ec2.Vpc.fromExistingIds
b
i don't believe it can be done with
fromExistingIds
no, because that particular method only populates the vpc itself, not the res of the resources inside the component (I think)
v
Yeah, it is working like that. However, when I looked in the source code of
awsx.ec2.Vpc
, I found some populating code. Not sure when it gets called
The easy way would be to export route table IDs from other stack, and use it while creating peering connection, in that case.
m
heya, I am having the same issues, it seems you have to set it manually
Copy code
const publicSubnets = await aws.ec2.getSubnetIds({
      vpcId: vpcId,
      filters: [{ name: 'tag:type', values: ['public'] }],
    });
    const privateSubnets = await aws.ec2.getSubnetIds({
      vpcId: vpcId,
      filters: [{ name: 'tag:type', values: ['private'] }],
    });

awsx.ec2.Vpc.fromExistingIds(name, {
      vpcId: vpcId,
      publicSubnetIds: publicSubnetIds,
      privateSubnetIds: privateSubnetIds,
    });
🙌 1
hopefully @billowy-army-68599 can verify this whether it is true?
b
that looks correct to me
🙌 1
v
@miniature-advantage-31279 Thanks for the solution, for a quick testing, I exported the
publicSubnetIds
and
privateSubnetIds
from other stack and using
awsx.ec2.Vpc.fromExistingIds
. Unfortunately, that seemed not populating
routeTables
properties of
awsx.ec2.Subnet
instances. Ultimately, I ended up exporting
routeTableIds
itself from another stack 😅
m
yeah that also alternative that I did
v
Ah, okay 👍