Kongregate’s infrastructure is represented entirely in code via AWS CloudFormation. CloudFormation is a templating system built by AWS for managing their infrastructure as code; you can read more about CloudFormation here. Since Kongregate’s infrastructure is entirely in code, it has been necessary to solve a number of limitations in the CloudFormation structure.
One such limitation in CloudFormation is cross stack dependencies. When defining entire infrastructure as code, it becomes a requirement to break down the architecture into logical components (e.g. DNS, web nodes, security groups, etc.). CloudFormation can handle this by nesting a stack within another stack, aptly named "nested stacks" (you can read more here about nested stacks). The major downside to CloudFormation’s nested stacks is its limited flexibility.
The Sony Xperia team came up with a great workaround. Using AWS Lambda as an intermediary layer, CloudFormation can reference another stack’s output as an input without a rigid code structure to maintain. Check out their repo here. This tool allows for simpler CloudFormation templates, better code maintainability, and improved overall readability.
To get started with stack dependencies in CloudFormation, follow these steps:
You will need an AWS account and git installed locally
Download the Sony Xperia repo locally (GitHub repo)
AWS CloudFormation is an extremely powerful tool that can be further extended using Lambda. Using Lambda can give CloudFormation a more robust and powerful DSL for infrastructure provisioning and management.
Author
Richard Howard
DevOps Engineer at Kongregate. Audiophile, father, and husband. He builds audio gear, digital robots, and a mean cup of coffee… in that order.