Skip to content

Instantly share code, notes, and snippets.

@elbertwang
Created December 18, 2015 10:46
Show Gist options
  • Save elbertwang/cad02ae7e21b1bcd698f to your computer and use it in GitHub Desktop.
Save elbertwang/cad02ae7e21b1bcd698f to your computer and use it in GitHub Desktop.
describe_ec2_vpc_boto2.py
from boto import vpc
connvpc = vpc.connect_to_region('cn-north-1')
vpcs = connvpc.get_all_vpcs()
subnets = connvpc.get_all_subnets()
print vpcs
print subnets
for vpc in vpcs:
print vpc
for vpc_subnet in connvpc.get_all_subnets(filters={"vpcId":vpc.id}):
print vpc_subnet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment