Skip to content

The replace_route command normalised an erroneous entry and incorrectly set default route in multiple routing tables

0

Hi There,

I recently made the error of specifying --destination-cidr-block 192.168.230.24/0 in a replace_route command instead of 192.168.230.0/24 in a AWS CLI session and the routing table entry for 0.0.0.0/0 was changed unintentionally.

Is this expected behaviour? Entering 192.168.230.24/0 in the AWS Console GUI will stop you with an error with invalid CIDR but the CLI silently accepts and normalises 192.168.230.24/0 to the 0.0.0.0/0 entry. I will in future use the dry run option but I'dve thought that there'd be a warning or error.

The result is that a production environment was degraded as the default route was assigned a ENI from an IGW entry.

I have logged with AWS but they state that this behaviour has always been the case and possibly wont change not even with a warning?

I am interested to know if this is documented behaviour.

Thanks and regards

Dek

asked a month ago107 views

2 Answers
1
Accepted Answer

Hello.

The AWS VPC documentation explicitly states that when routes are managed via the CLI or API, the destination CIDR is automatically converted to its canonical form; for example, 100.68.0.18/18 is converted to 100.68.0.0/18. The commands listed as subject to this behavior are create-route, replace-route, and delete-route.
That is likely why it ended up as 0.0.0.0/0.
https://docs.aws.amazon.com/vpc/latest/userguide/WorkWithRouteTables.html

To update the routes for a route table using the AWS CLI
If you add a route using a command line tool or the API, the destination CIDR block is automatically modified to its canonical form. For example, if you specify 100.68.0.18/18 for the CIDR block, we create a route with a destination CIDR block of 100.68.0.0/18.

EXPERT

answered a month ago

AWS
SUPPORT ENGINEER

reviewed a month ago

0

Hi Riku,

Many thanks for highlighting the behaviour in the documentation.

Regards

Dek

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.