CloudFormation Demo
Basic VPC
This CloudFormation template sets up a basic VPC across two AZs, with both a public and a private subnet in each AZ. It also configures a simple Bastion Host which can receive SSH connections. All the elements that you would expect to find in such a VPC, including route tables, an internet gateway and a security group for the bastion, are also created.
Through the use of parameters you can choose the Bastion EC2 instance type and the IP address ranges to use for the VPC and subnets.
This CloudFormation template is setup to be deployable in two regions: eu-west-1 and eu-central-1. Using maps, it picks up the right AMI id and the right SSH key to use for the Bastion host.
The template is setup so that it can be embedded in other templates: It has "Outputs" for the ID of the VPC and all subnets.
Link to the templateALB/ASG
This CloudFormation template sets up a Load Balancer, with an Auto Scaling Group backend. It then loads the LB DNS name as an alias into Route 53.
It uses the VPC template mentioned above to setup the VPC. Because the VPC template requires parameters, these parameters are now requested from this template, and forwarded to the VPC template. The outputs of the VPC template are then used in this template.
In addition to the VPC paramters, several more parameters need to be handled, for instance the compute node instance type, and the DNS domain name to use.
Again, this template is setup with mappings so that it can be deployed in two regions: eu-west-1 and eu-central-1.
Eventually, this template will build a Pi calculation farm. You can browse to the web page, set the requested scale and have the farm calculate Pi to that scale for you. (Note that scales above 2500 decimal places typically causes timeouts, either in your browser or in the LB. So although it's technically possible to calculate much more than 2500 decimal places, the script is capped at 2500.)
Link to the template (Classic Elastic Load Balancer version)
Link to the template (new Application Load Balancer version)
Please note that both templates link to resources specific for my account: SSH keys, domain names, AMI IDs and a few other things. You cannot use these templates directly in a different account, but you can see the structure and ideas behind CloudFormation templates. Also, if you change the templates to match your resources, you should be able to get them running in your account rather quickly. If you want the code that implements the Pi calculator, contact me. Who knows, I might just put them in a CloudFormation template in the future (as UserData).
Other templates
The templates below are templates that I use for various other production systems or demos. As with the ALB/ASG template, they may contain resources that are specific for my account and may not work, without modification, in a different account.
- A Linux "play" system (A basic Linux system to play with.)
- FRDemo (Sets up the Kinesis stream with associated bits and pieces.)