Routing in the Private Subnet

The following code block shows how we can create route tables in each of the two private subnets, and add routing rules to route all traffic to the NAT gateway that we created in the public subnet:

    letsPollPrivateRouteTable1:      Type: AWS::EC2::RouteTable      Properties:        VpcId:          Ref: letsPollVPC  letsPollDefaultPrivateRoute1:    Type: AWS::EC2::Route    Properties:      RouteTableId:        Ref: letsPollPrivateRouteTable1      DestinationCidrBlock: 0.0.0.0/0      NatGatewayId:        Ref: letsPollVPCNatGateway  letsPollPrivateSubnet1RouteTableAssociation:    Type: AWS::EC2::SubnetRouteTableAssociation    Properties:      RouteTableId:        Ref: letsPollPrivateRouteTable1      SubnetId:        Ref: letsPollPrivateSubnet1  letsPollPrivateSubnet2RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation ...

Get Hands-On Serverless Applications with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.