Description
0.0.0.0/0 and ::/0 select a target for IPv4 or IPv6 traffic that has no more specific route.
Potential impact
An incorrect target can interrupt required connections or create an unintended external path.
Remediation
Keep the default routes your subnet needs and check the target for each destination. Use security groups and network ACLs to control which traffic is allowed.
Examples
The first excerpt sends default IPv4 traffic to a NAT gateway and IPv6 traffic to an egress-only internet gateway. The second routes only 172.16.0.0/24 to a transit gateway. Choose the routes your subnet needs and supply the referenced resources and attachments. If the same stack creates the VPC’s transit gateway attachment, set the route’s DependsOn to that attachment.
Before
Resources:
PublicRoute1:
Type: AWS::EC2::Route
Properties:
RouteTableId: !Ref PublicRouteTable
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId: !Ref NatGateway
PublicRoute2:
Type: AWS::EC2::Route
Properties:
RouteTableId: !Ref PublicRouteTable
DestinationIpv6CidrBlock: ::/0
EgressOnlyInternetGatewayId: !Ref EgressOnlyInternetGateway
After
Resources:
PublicRoute1:
Type: AWS::EC2::Route
Properties:
RouteTableId: !Ref PublicRouteTable
DestinationCidrBlock: 172.16.0.0/24
TransitGatewayId: !Ref TransitGateway