// New NAT gateway creation
const natGateway = new ec2.CfnNatGateway(this, 'nat-gateway-1',{
subnetId: mySubnet.subnetId,
allocationId: new ec2.CfnEIP(this, 'eip-1', {
domain: 'vpc'
}).attrAllocationId
})
// Route table instantiation
const routeTable = new ec2.CfnRouteTable(this, 'route-table-1', {
vpcId: vpc.vpcId,
})
// Setting up a route
const route = new ec2.CfnRoute(this, 'route-1', {
// How do I obtain the ID for the route table?
routeTableId: 'obtaining the id?',
natGatewayId: 'how do I retrieve the id?',
destinationCidrBlock: vpc.vpcCidrBlock
})
Working with TypeScript, how can I acquire the ID when creating a route table or NAT gateway?