Name: aws-cidr-finder
Owner: Amazon Web Services - Labs
Owner: AWS Samples
Description: A lambda function, a cloudformation template to get it running, and example templates showing how to use a custom resource (calling the lambda) to automatically calculate CIDR ranges for subnets based on the VPC range.
Created: 2016-12-22 22:27:32.0
Updated: 2018-01-12 20:32:14.0
Pushed: 2017-11-08 22:30:19.0
Homepage: null
Size: 69
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
AWS CIDR Finder is a tool for adding more convenience to your AWS CloudFormation templates and AWS Service Catalog products by calculating the CIDR ranges of new subnets for you so that your users don't have to supply them.
In the DevOps world, where automation rules, the exact IP addresses of your servers don't really matter when they can otherwise be identified by tagging or API calls. For that reason, when launching CloudFormation stacks, it's good to have an option not to have to specify the CIDR ranges for your subnets.
AWS CIDR finder provides a Lambda function that can be used as a custom resource within your own CloudFormation templates to calculate CIDR ranges.
First of all, you need to install AWS CIDR finder in your account. The included install.sh
script will create the lambda function for you and provide an exported CloudFormation value that you can make use of in your own templates.
The following example is included in full in the cfn
directory and creates a new VPC along with 3 new subnets using automatically calculated CIDR ranges.
urces:
Create a new VPC for the example
c:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 192.168.0.0/23
Call the custom resource, specify 3 subnets of different sizes.
The resource will have properties called CidrBlock1, CidrBlock2, and CidrBlock3 to contain the 3 CIDR block definitions
drFindr:
Type: Custom::CidrFindr
Properties:
ServiceToken: !ImportValue CidrFindr
VpcId: !Ref Vpc # Refer to the VPC created above
Sizes: [24, 25, 26] # 3 subnets of differing sizes
Use the first cidr block from the CidrFindr resource
bnet1:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: !GetAtt CidrFindr.CidrBlock1
VpcId: !Ref Vpc
Use the second cidr block from the CidrFindr resource
bnet2:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: !GetAtt CidrFindr.CidrBlock2
VpcId: !Ref Vpc
Use the third cidr block from the CidrFindr resource
bnet3:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: !GetAtt CidrFindr.CidrBlock3
VpcId: !Ref Vpc