Not able to get the resources attached with route table
<p>I am  using python for AWS  infrastructure automation.
I need to get the resources attached with the Route Table for which API given is </p>

<pre><code>ec2  = boto3.resource('ec2')
route_table_association = ec2.RouteTableAssociation('rtb-**********')
response=route_table_association.get_available_subresources()
</code></pre>

<p>Here the return type of response is giving me the empty list all the time. and <code>response=route_table_association.delete()</code> gives the exception</p>

<pre><code>An error occurred (InvalidAssociationID.NotFound) when calling the `DisassociateRouteTable operation: The association ID 'rtb-*********' does not exist.`
</code></pre>

<p>But the route tebale exist and is attached to a subnet explicitly</p>

<p>The id required are <a href="http://boto3.readthedocs.io/en/latest/reference/services/ec2.html#EC2.RouteTableAssociation.id" rel="nofollow">RouteTableAssociationId i.e. rtbassoc-xxxxxx </a>, <strong>NOT the route table id</strong>.</p>

<p>RouteTableAssociationId is inside  <a href="http://boto3.readthedocs.io/en/latest/reference/services/ec2.html#EC2.Client.describe_route_tables" rel="nofollow">describe_route_tables</a> response JSON 'Associations' element.  </p>

<pre><code>{
    'RouteTables': [
        {
            'RouteTableId': 'string',
            'VpcId': 'string',
            'Routes': [
                {....}
            ],
            'Associations': [
                {
                    'RouteTableAssociationId': 'string',
                    'RouteTableId': 'string',
                    'SubnetId': 'string',
                    'Main': True|False
                },
            ],
.....
}
</code></pre>

python amazon-web-services amazon-ec2 boto3 botocore