Florin Andrei
Florin Andrei

Reputation: 1097

AWS boto: how to get a list of all Internet gateways attached to a VPC

Given a VPC ID, find all gateways attached to it.

I tried to use filters, like these here, but I always get exceptions:

gws = conn.get_all_internet_gateways(filters={'attachments': vpc.id})
gws = conn.get_all_internet_gateways(filters={'InternetGatewayAttachment': vpc.id})

What's the correct filter here?

What are the filters allowed in this context?

The documentation on this topic is pretty scarce.

Upvotes: 0

Views: 2292

Answers (1)

garnaat
garnaat

Reputation: 45856

The AWS documentation for the DescribeInternetGateways request shows the available filters. I think you want:

gws = conn.get_all_internet_gateways(filters={'attachment.vpc-id': vpc.id})

Upvotes: 1

Related Questions