Amazon-VPC [SOLVED]: RouteTable: None in AWS Boto get_all_route_tables()

Amazon-VPC [SOLVED]: RouteTable: None in AWS Boto get_all_route_tables()

Home Forums Amazon Web Services Amazon VPC Amazon-VPC [SOLVED]: RouteTable: None in AWS Boto get_all_route_tables()

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #166027

    Cloudy Point
    Keymaster

    QuestionQuestion

    When I grab all route tables using:

    conn=boto.vpc.connect_to_region("us-east-1")
    c=conn.get_all_route_tables()

    output contains multiple list items of RouteTable:None in addition to route table ids I expect:

    [RouteTable:rtb-123xyzz,
    RouteTable:rtb-456abcc,
    RouteTable:None,
    RouteTable:None,
    RouteTable:None,

    Can someone tell why these none items are included in the output?
    With them in there, I am not able to iterate over to get more attribute/value info.

    Thank you,

    #166028

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    Not sure why some route table ids are None. It could be the route table creation was aborted. But iterating through them is your issue, you can do:

    • Delete those route tables
    • Ignore those route tables

    It is easy to ignore them in python:

    for rt in c:
      if rt.id  # Valid route table id
        # Do your stuff
    

    Or just filter out the None route tables:

    route_tables = [rt for rt in c if rt.id]
    

    Source: https://stackoverflow.com/questions/45357159/routetable-none-in-aws-boto-get-all-route-tables
    Author: helloV
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.