[DL.EAC.6] Use general-purpose programming languages to generate Infrastructure-as-Code
Category: RECOMMENDED
Developing infrastructure as code (IaC) using general-purpose programming languages aligns closely with modern software development practices and DevOps principles. IaC has traditionally been implemented as predefined templates modeled through domain-specific languages using markup languages like JSON or YAML. During deployment, these templates are provided parameters which specify environment-specific details. While parameterized templates are still a best practice for traditional IaC templates, this approach can become difficult to develop, troubleshoot, and manage as infrastructure and environments become more complex.
Using general-purpose programming languages changes how we develop, manage, and deploy IaC. It is no longer a collection of parameterized templates, but instead infrastructure is written in common programming languages such as TypeScript, Python, or Java, and can be treated the same as other code throughout the development lifecycle. Instead of providing environment-specific configuration during deployment, tools like AWS Cloud Development Kit (AWS CDK) generate separate templates for each environment using configurations defined in source code. This provides a more predictable, consistent, and reproducible deployment process.
Transitioning to using general-purpose programming languages
for IaC can also change how you govern IaC at scale. For
example, AWS CDK includes the ability to consume, publish, and
version software components called AWS CDK
constructs
through private artifact registries or the
open-source Construct
Hub
Related information: