def get_all_peering_connections()

in lambda/vpcgraph.py [0:0]


def get_all_peering_connections():
    peering_connections = list()

    # Describe VPC peering connections
    resp = ec2.describe_vpc_peering_connections()
    peering_connections.extend(resp['VpcPeeringConnections'])

    # Keep describing peering connections until there are no more
    while 'NextToken' in resp:
        resp = ec2.describe_vpc_peering_connections(
            NextToken=resp['NextToken']
        )
        peering_connections.extend(resp['VpcPeeringConnections'])

    return peering_connections