Giter Club home page Giter Club logo

aws_describe_unused_ips's Introduction

AWS Describe Unused IPs

Python Script that describes the following IPv4 information for the specified Subnet.

  • CIDR
  • CIDR IPs
  • Reserved IPs
  • Used IPs (by NetworkInterfaces)
  • Unused IPs (= CIDR IPs - Reserved IPs - Used IPs)

Requirements

  • >Python3.8
  • boto3
  • AWS Permissions
    • ec2:DescribeSubnets
    • ec2:DescribeNetworkInterfaces

Usage

export AWS_DEFAULT_REGION={region name}
export AWS_DEFAULT_PROFILE={aws profile name}
python describe_unused_ips.py {subnet-id} [lb] 

lb = Line Break mode

e.g.

Normal mode

export AWS_DEFAULT_REGION=ap-northeast-1
export AWS_DEFAULT_PROFILE=my_aws_account
python describe_unused_ips.py subnet-000000000000

output

subnet_id='subnet-000000000000' mode='normal'
cidr='10.1.0.0/24'
cidr_ips=['10.1.0.0', '10.1.0.1', '10.1.0.2', '10.1.0.3', '10.1.0.4', ...]
-----------
reserved_ips=['10.1.0.0', '10.1.0.1', '10.1.0.2', '10.1.0.3', '10.1.0.255']
-----------
used_ips=['10.1.0.39']
-----------
unused_ips=['10.1.0.4', '10.1.0.5', '10.1.0.6', ...]
-----------
cidr=10.1.0.0/24 cidr_ips=256 reserved=5 used=1 unused=250

Line Break mode

export AWS_DEFAULT_REGION=ap-northeast-1
export AWS_DEFAULT_PROFILE=my_aws_account
python describe_unused_ips.py subnet-000000000000 lb

output

subnet_id='subnet-0775762f52d4a3bd4' mode='lb'
cidr='10.1.0.0/24'
cidr_ips=
10.1.0.0
10.1.0.1
10.1.0.2
10.1.0.3
10.1.0.4
...
-----------
reserved_ips=
10.1.0.0
10.1.0.1
10.1.0.2
10.1.0.3
10.1.0.255
-----------
used_ips=
10.1.0.39
-----------
unused_ips=
10.1.0.4
10.1.0.5
10.1.0.6
...
-----------
cidr=10.1.0.0/24 cidr_ips=256 reserved=5 used=1 unused=250

aws_describe_unused_ips's People

Contributors

shu85t avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.