Kruunch Arz
Kruunch Arz

Reputation: 53

Python Boto Deleting Routes?

I've been trying to find a way to delete routes in AWS programatically. I've built a python application for managing AWS resources using boto and boto3. When dealing with the clean up after deletion of VPC Peering, I have blackholed routes left over. I don't want to delete the Route Tables in question, just the blackholed routes.

The AWS CLI has a delete-route function, but I can't find the corresponding function in boto and I'd prefer not to run the AWS CLI directly from my python app if I can avoid it.

In boto3 (and boto) there are methods for creating routes, but I couldn't find any for deleting routes (just deleting the whole route table). I've searched this out numerous times but haven't come close to finding an answer.

Any help?

Upvotes: 0

Views: 1324

Answers (1)

helloV
helloV

Reputation: 52463

I do see a method in boto 2.38.

class boto.vpc.VPCConnection

delete_route(route_table_id, destination_cidr_block, dry_run=False)

Deletes a route from a route table within a VPC.

Parameters:

route_table_id (str) – The ID of the route table with the route.

destination_cidr_block (str) – The CIDR address block used for destination match.

dry_run (bool) – Set to True if the operation should not actually run.

Return type: bool Returns: True if successful

Upvotes: 1

Related Questions