Coder Social home page Coder Social logo

cidrblocks's Introduction

cidrblocks

Generate subnets within Availability Zones from a CIDR.

CLI Usage

Only the --cidr flag is necessary. By default, it splits into four availability zones and outputs a table:

(cidrblocks)(master) → ./cidrblocks --cidr=10.0.0.0/20
VPC Range - 10.0.0.0/20

AZ a (10.0.0.0/22):
	10.0.0.0/23 (Private - 512 addresses)
	10.0.2.0/24 (Public - 256 addresses)
	10.0.3.0/25 (Protected - 128 addresses)
	10.0.3.128/25 (Extra - 128 addresses)

AZ b (10.0.4.0/22):
	10.0.4.0/23 (Private - 512 addresses)
	10.0.6.0/24 (Public - 256 addresses)
	10.0.7.0/25 (Protected - 128 addresses)
	10.0.7.128/25 (Extra - 128 addresses)

AZ c (10.0.8.0/22):
	10.0.8.0/23 (Private - 512 addresses)
	10.0.10.0/24 (Public - 256 addresses)
	10.0.11.0/25 (Protected - 128 addresses)
	10.0.11.128/25 (Extra - 128 addresses)

AZ d (10.0.12.0/22):
	10.0.12.0/23 (Private - 512 addresses)
	10.0.14.0/24 (Public - 256 addresses)
	10.0.15.0/25 (Protected - 128 addresses)
	10.0.15.128/25 (Extra - 128 addresses)

The number of availability zones can be specified:

(cidrblocks)(master) → ./cidrblocks --cidr=10.0.0.0/20 --azs=3
VPC Range - 10.0.0.0/20

AZ a (10.0.0.0/22):
	10.0.0.0/23 (Private - 512 addresses)
	10.0.2.0/24 (Public - 256 addresses)
	10.0.3.0/25 (Protected - 128 addresses)
	10.0.3.128/25 (Extra - 128 addresses)

AZ b (10.0.4.0/22):
	10.0.4.0/23 (Private - 512 addresses)
	10.0.6.0/24 (Public - 256 addresses)
	10.0.7.0/25 (Protected - 128 addresses)
	10.0.7.128/25 (Extra - 128 addresses)

AZ c (10.0.8.0/22):
	10.0.8.0/23 (Private - 512 addresses)
	10.0.10.0/24 (Public - 256 addresses)
	10.0.11.0/25 (Protected - 128 addresses)
	10.0.11.128/25 (Extra - 128 addresses)

Unused blocks:
	10.0.12.0/22

It can also output in four formats:

  • table
  • cloudformation
  • terraform
  • cli (AWS cli commands) (coming soon)
(cidrblocks)(master) → ./cidrblocks --cidr=10.0.0.0/20 --format=cloudformation
{
	"AWSTemplateFormatVersion" : "2010-09-09",
	"Resources" : {
...

Web Service

Alternatively, cidrblocks can be run as a web service:

(cidrblocks)(master) → ./cidrblocks serve --port=8087

http://localhost:8087/?format=table&cidr=10.0.0.0/8
http://localhost:8087/?format=cloudformation&cidr=10.0.0.0/8&azs=2

Library

cidrblocks can also be used as a library within another application with the cidrblocks/subnet subpackage.

cidrblocks's People

Contributors

bison avatar brianredbeard avatar iankronquist avatar tschuy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cidrblocks's Issues

lib it out!

Main obstacle here: Most applications making use of this library will want to deal with go objects of some sort at runtime, rather than string literals which need to be unmarshalled, modified and re-marshalled in most use cases.

There are some architectural "additions" I'll venture a recommendations towards:

  • An intermediate representation (IR) for a generated network layout that can then render to to any of our various output formats (table, terraform, cloudformation). This IR will be the "stable" interface this package will present to dependent codebases going forward.

Later on, perhaps we can extract the individual output formats into implementations behind a common interface and attempt to provide an abstraction layer for actually constructing these configs across providers. Given that there are a lot of different ways to slice that cake, I think we're better off (for now) settling on an expressive enough IR and leaving it up to those implementing on top of the library to construct their own output configurations from the generated network layout IR.

\cc @tschuy @brianredbeard

Terraform output

Terraform output should be verified as working, and if not, fixed.

naming

The VPC/Subnet/AZ/etc naming should be clarified/made accurate.

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.