Skip to content

Instantly share code, notes, and snippets.

@elbertwang
Created December 18, 2015 10:46
Show Gist options
  • Select an option

  • Save elbertwang/cad02ae7e21b1bcd698f to your computer and use it in GitHub Desktop.

Select an option

Save elbertwang/cad02ae7e21b1bcd698f to your computer and use it in GitHub Desktop.

Revisions

  1. elbertwang created this gist Dec 18, 2015.
    14 changes: 14 additions & 0 deletions describe_ec2_vpc_boto2.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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