

# Infrastructure as code
<a name="infrastructure-as-code"></a>

 A fundamental principle of DevOps is to treat infrastructure the same way developers treat code. Application code has a defined format and syntax. If the code is not written according to the rules of the programming language, applications cannot be created. Code is stored in a version management or source control system that logs a history of code development, changes, and bug fixes. When code is compiled or built into applications, we expect a consistent application to be created, and the build is repeatable and reliable. 

 Practicing *infrastructure as code* means applying the same rigor of application code development to infrastructure provisioning. All configurations should be defined in a declarative way and stored in a source control system such as [AWS CodeCommit](https://aws.amazon.com/codecommit), the same as application code. Infrastructure provisioning, orchestration, and deployment should also support the use of the infrastructure as code. 

Infrastructure was traditionally provisioned using a combination of scripts and manual processes. Sometimes these scripts were stored in version control systems or documented step by step in text files or run-books. Often the person writing the run books is not the same person executing these scripts or following through the run-books. If these scripts or runbooks are not updated frequently, they can potentially become a show-stopper in deployments. This results in the creation of new environments not always being repeatable, reliable, or consistent.

In contrast, AWS provides a DevOps-focused way of creating and maintaining infrastructure. Similar to the way software developers write application code, AWS provides services that enable the creation, deployment and maintenance of infrastructure in a programmatic, descriptive, and declarative way. These services provide rigor, clarity, and reliability. The AWS services discussed in this paper are core to a DevOps methodology and form the underpinnings of numerous higher-level AWS DevOps principles and practices.

AWS offers the following services to define infrastructure as code.

**Topics**
+ [CloudFormation](aws-cloudformation.md)
+ [AWS Serverless Application Model](aws-serverless-application-model.md)
+ [AWS Cloud Development Kit (AWS CDK)](aws-cdk.md)
+ [AWS Cloud Development Kit for Kubernetes](aws-cdk-for-kubernetes.md)
+ [AWS Cloud Development Kit for Terraform](aws-cdk-for-terraform.md)
+ [AWS Cloud Control API](aws-cloud-control-api.md)