Package: cdk-vpc-module
cdk-vpc-modulecdk-vpc-module construct library is an open-source extension of the AWS Cloud Development Kit (AWS CDK) to deploy configurable aws vpc  and its individual components in less than 50 lines of code and human readable configuration which can be managed by pull requests!:sparkles: Features:white_check_mark: Option to configure custom IPv4 CIDR(10.10.0.0/24):white_check_mark: VPC Peering with  route table entry:white_check_mark: Configurable NACL as per subnet group:white_check_mark: NATGateway as per availabilityZonesUsing cdk a vpc can be deployed using the following sample code snippet:import{Network}from"@smallcase/cdk-vpc-module/lib/constructs/network";import{aws_ec2asec2,App,Stack,StackProps}from"aws-cdk-lib";import{Construct}from"constructs";exportclassVPCStackextendsStack{constructor(scope:Construct,id:string,props:StackProps={}){super(scope,id,props);newNetwork(this,'NETWORK',{vpc:{cidr:'10.10.0.0/16',subnetConfiguration:[],},peeringConfigs:{"TEST-PEERING":{//thiskeywillbeusedasyourpeeringid,whichyouwillhavetomentionbelowwhenyouconfigurearoutetableforyoursubnetspeeringVpcId:"vpc-0000",tags:{"Name":"TEST-PEERING to CREATED-VPC","Description":"Connect"}}},subnets:[{subnetGroupName:'NATGateway',subnetType:ec2.SubnetType.PUBLIC,cidrBlock:['10.10.0.0/28','10.10.0.16/28','10.10.0.32/28'],availabilityZones:['ap-south-1a','ap-south-1b','ap-south-1c'],ingressNetworkACL:[{cidr:ec2.AclCidr.ipv4('0.0.0.0/0'),traffic:ec2.AclTraffic.allTraffic(),},],routes:[],egressNetworkACL:[{cidr:ec2.AclCidr.ipv4('0.0.0.0/0'),traffic:ec2.AclTraffic.allTraffic(),},],},{subnetGroupName:'Public',subnetType:ec2.SubnetType.PUBLIC,cidrBlock:['10.10.2.0/24','10.10.3.0/24','10.10.4.0/24'],availabilityZones:['ap-south-1a','ap-south-1b','ap-south-1c'],ingressNetworkACL:[{cidr:ec2.AclCidr.ipv4('0.0.0.0/0'),traffic:ec2.AclTraffic.allTraffic(),},],egressNetworkACL:[{cidr:ec2.AclCidr.ipv4('0.0.0.0/0'),traffic:ec2.AclTraffic.allTraffic(),},],routes:[],tags:{//ifyouusethisvpcforyourekscluster,youhavetotagyoursubnets[readmore](https://aws.amazon.com/premiumsupport/knowledge-center/eks-vpc-subnet-discovery/)'kubernetes.io/role/elb':'1','kubernetes.io/cluster/TEST-CLUSTER':'owned',},},{subnetGroupName:'Private',subnetType:ec2.SubnetType.PRIVATE_WITH_NAT,cidrBlock:['10.10.5.0/24','10.10.6.0/24','10.10.7.0/24'],availabilityZones:['ap-south-1a','ap-south-1b','ap-south-1c'],ingressNetworkACL:[{cidr:ec2.AclCidr.ipv4('0.0.0.0/0'),traffic:ec2.AclTraffic.allTraffic(),},],egressNetworkACL:[{cidr:ec2.AclCidr.ipv4('0.0.0.0/0'),traffic:ec2.AclTraffic.allTraffic(),},],routes:[{//ifyouusethisvpcforyourekscluster,youhavetotagyoursubnets[readmore](https://aws.amazon.com/premiumsupport/knowledge-center/eks-vpc-subnet-discovery/)routerType:ec2.RouterType.VPC_PEERING_CONNECTION,destinationCidrBlock:"<destinationCidrBlock>",//<YourVPCPeeringConfigKEY,inthisexampleTEST-PEERINGwillbeyourID>existingVpcPeeringRouteKey:"TEST-PEERING"}],tags:{'kubernetes.io/role/internal-elb':'1','kubernetes.io/cluster/TEST-CLUSTER':'owned',},},{subnetGroupName:'Database',subnetType:ec2.SubnetType.PRIVATE_WITH_NAT,cidrBlock:['10.10.14.0/27','10.10.14.32/27','10.10.14.64/27'],availabilityZones:['ap-south-1a','ap-south-1b','ap-south-1c'],ingressNetworkACL:[{cidr:ec2.AclCidr.ipv4('0.0.0.0/0'),traffic:ec2.AclTraffic.allTraffic(),},],egressNetworkACL:[{cidr:ec2.AclCidr.ipv4('0.0.0.0/0'),traffic:ec2.AclTraffic.allTraffic(),},],routes:[],tags:{},},],});}}constenvDef={account:'<AWS-ID>',region:'<AWS-REGION>',};constapp=newApp();newVPCStack(app,'TEST',{env:envDef,terminationProtection:true,tags:{});app.synth();Please referhereto check how to use individual resource constructs.:clapper: Quick StartThe quick start shows you how to create anAWS-VPCusing this module.PrerequisitesA workingawsCLI installation with access to an account and administrator privilegesYou'll need a recentNodeJSinstallationTo get going you'll need a CDK project. For details please refer to thedetailed guide for CDK.Create an empty directory on your system.mkdiraws-quick-start-vpc&&cdaws-quick-start-vpcBootstrap your CDK project, we will use TypeScript, but you can switch to any other supported language.npxcdkinitsample-vpc--languagetypescript
npxcdkbootstrapInstall using NPM:npm install @smallcase/cdk-vpc-moduleUsing yarnyarn add @smallcase/cdk-vpc-moduleCheck the changed which are to be deployed~->npxcdkdiffDeploy using~->npxcdkdeploy