mardi 12 juillet 2016

Find route_table_id by subnet_id using boto3

I'm trying to figure out how to find route_table_id based upon a subnet_id(in a vpc) using boto3. There is api in boto3(v1.3.1), ec2.RouteTableAssociation(id). With correct route_table_association_id, try to access the resource's attribute route_table_id, it gives exception as below:

In [19]: rta.route_table_id
---------------------------------------------------------------------------
ResourceLoadException                     Traceback (most recent call last)
<ipython-input-19-a7f51e66ef03> in <module>()
----> 1 rta.route_table_id

/usr/local/lib/python2.7/site-packages/boto3/resources/factory.pyc in property_loader(self)
    341                 else:
    342                     raise ResourceLoadException(
--> 343                         '{0} has no load method'.format(self.__class__.__name__))
    344
    345             return self.meta.data.get(name)

ResourceLoadException: ec2.RouteTableAssociation has no load method

I'm looking for a clue why this failed.

James

Aucun commentaire:

Enregistrer un commentaire