Skip to main content

Python AWS VPC CIDR available range finder with sub networks

Project description

PyVPC - CIDR free ranger resolver

Current version supports only AWS VPCs.
CIDR available range finder with sub networks

Install

pip install pyvpc

Usage

aws:

pyvpc aws [-h] [--cidr-range CIDR_RANGE]
          [--suggest-range {0-32}]
          [--num-of-addr NUM_OF_ADDR] [--region REGION]
          [--all-regions] [--vpc VPC]

Examples

  • Assuming there are two AWS VPCs with CIDRs: 10.20.0.0/16 and 10.30.0.0/16, executing command:

    pyvpc aws --cidr-range 10.0.0.0/8
    

    will return:

    | Lowest IP   | Upper IP       |   Num of Addr | Available   | ID                    | Name         |
    |-------------|----------------|---------------|-------------|-----------------------|--------------|
    | 10.0.0.0    | 10.19.255.255  |       1310720 | True        |                       |              |
    | 10.20.0.0   | 10.20.255.255  |         65536 | False       | vpc-Ec9hQfmjk4sPCH65c | lev-test-vpc |
    | 10.21.0.0   | 10.29.255.255  |        589824 | True        |                       |              |
    | 10.30.0.0   | 10.30.255.255  |         65536 | False       | vpc-4WNpVY5wCLmdqfJLy | dev-k8s      |
    | 10.31.0.0   | 10.255.255.255 |      14745600 | True        |                       |              |
    
  • For example, a VPC had the 10.50.0.0/16 cidr, executing command:

    pyvpc aws --vpc vpc-3w5cymcdnwjm389gq
    

    will return:

    | Lowest IP   | Upper IP      |   Num of Addr | Available   | ID                       | Name               |
    |-------------|---------------|---------------|-------------|--------------------------|--------------------|
    | 10.50.0.0   | 10.50.0.255   |           256 | True        |                          |                    |
    | 10.50.1.0   | 10.50.1.255   |           256 | False       | subnet-p7s6f7rsgrgtvr5fe | private-arie-test  |
    | 10.50.2.0   | 10.50.2.255   |           256 | False       | subnet-2nw28z822kcr9x726 | private-arie-test  |
    | 10.50.3.0   | 10.50.10.255  |          2048 | True        |                          |                    |
    | 10.50.11.0  | 10.50.11.255  |           256 | False       | subnet-3j744kpzmcg55qtza | public-arie-test   |
    | 10.50.12.0  | 10.50.12.255  |           256 | False       | subnet-6vjape4vfk4jhajg8 | public-arie-test   |
    | 10.50.13.0  | 10.50.20.255  |          2048 | True        |                          |                    |
    | 10.50.21.0  | 10.50.21.255  |           256 | False       | subnet-j8wv89u4u3v4kyqs7 | database-arie-test |
    | 10.50.22.0  | 10.50.22.255  |           256 | False       | subnet-7p4djeetkkkgmqqqk | database-arie-test |
    | 10.50.23.0  | 10.50.255.255 |         59648 | True        |                          |                    |
    
  • Find next available network: For example we pass the --cidr-range 10.0.0.0/8 value, on the first example (10.20.0.0/16 and 10.30.0.0/16 are reserved).

    By adding --suggest-range 16 the result will be 10.0.0.0/16, as it the first available network with prefix 16.

    Or if adding --num-of-addr 2200000 (we need 2.2 million addresses), the result will be 10.64.0.0/10 as it the first available network containing this amount.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvpc-0.0.7.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

pyvpc-0.0.7-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file pyvpc-0.0.7.tar.gz.

File metadata

  • Download URL: pyvpc-0.0.7.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for pyvpc-0.0.7.tar.gz
Algorithm Hash digest
SHA256 53ff3fd2f074684c4700844e4971dabef9fd2690bfa82eeefb3d57ac89c9175e
MD5 82949177b73dfc710e2203b48e71a946
BLAKE2b-256 3b07a641d35587791f1f5bd095eb324ad90ae6d8d836db90462ff0cebfab6651

See more details on using hashes here.

Provenance

File details

Details for the file pyvpc-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: pyvpc-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for pyvpc-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c90f68794c3ee8ed02eb63c621eb38c4564df629ffaa3939d56507a663e25965
MD5 da09278d2f3841cca0239c9b8c033b5b
BLAKE2b-256 e749c29d76f82f155774f76807e4439d81a5a575275efd01dea6fb6fb36d99ce

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page