I recently co-hosted a developer workshop at the Melbourne AWS Programming & Tools Meetup that I wanted to share with anybody who wants to learn how to create reusable CloudFormation templates for managing AWS resources in a modular way.
The workshop focussed on how to create a VPC with both private and public subnets, and how to deploy bastion and ECS components into these subnets, using Cfhighlander, a feature rich tool & DSL for infrastructure coders that came out of the base2Services R&D lab. Additionally, the workshop covered how to deploy a single nginx service into an ECS cluster using CloudFormation.
More advanced users can also try and deploy a custom-built image to ECR, and then configure ECS service component to use it.
Try it for yourself. You can follow the workshop by visiting the GitHub link below, and completing the steps outlined on this page.
Workshop: github.com/theonestack/cfhighlander-workshops/tree/master/ecs-nginx
For successfull completion of all of the steps you will need the Docker image theonestack/workshop-tools:light. If you wish to go the extra step (advanced) section below, you will need the theonestack/workshop-tools:full Dockerfile.
To pull the docker image, execute below from your shell
docker pull theonestack/workshop-tools:light
To start the docker container from the image with interactive prompt, execute below from your shell. It will mount your AWS credentials to the container
docker run -it -e AWS_REGION=ap-southeast-2 -e AWS_DEFAULT_REGION=ap-southeast-2 -w /src -v $PWD:/src -v $HOME/.aws:/root/.aws theonestack/workshop-tools:light bash
You will also need the latest cfhighlander gem. Install it using gem command:
gem install cfhighlander
cfhighlander help
cfhighlander cfcompile