AWS route table export detail to CSV

Viewed 693

I need to export my route table detail to CSV. The goal is to load the CSV to a graphDB. What I need is the RoutetableID, CIDR block, Gateway and associated Subnet list as a CSV table. Would like to automate this as much as I can since I have several VPCs that I need to consolidate data for.

1- I can not find a BOTO3 query that provides this depth of detail. 2- AWS-config as well do not go to this depth. 3- AWS-CLI will get me the detail as a nested JSON. But here I loose the easy of automation.

Am I missing a detail here or does AWS not expose this detail for automation?

1 Answers

In AWS EC2 CLI, using describe-route-tables (link) you can fetch routetableID, CIDR block, gateway and associated subnet list. If you use this CLI, the automation will be fetching your four key value from JSON, converting into an array and writing it in a CSV.

The boto3 equivalent for this will be using RouteTable and RouteTableAssociation. This is a good example in python.

Related