This whitepaper is for historical reference only. Some content might be outdated and some links might not be available.
Infrastructure as Code
Modern deployment patterns require that applications, and the services and infrastructure and those applications depend on, can be provisioned and deployed reliably and consistently.
Given the complexity of deploying modern applications and infrastructure, doing so in a repeatable manner requires the deployment to be automated, and the practice and processes of automating infrastructure deployment are commonly known as Infrastructure as Code.
AWS CloudFormation
AWS CloudFormation
Using a simple text file called an AWS CloudFormation template
Templates can be written using JavaScript
Object Notation
You can use a variety of methods to deploy templates and provision resources, including
the AWS Management Console, AWS Command Line Interface (AWS CLI), and PowerShell or the AWS SDK for .NET.
You can also use the AWS Toolkit for Visual
Studio
A deployed version of a CloudFormation template is called a CloudFormation stack. You can instantiate one or multiple stacks based on each CloudFormation template, and delete deployed stacks and all resources associated with them. AWS CloudFormation is a powerful way to quickly deploy, duplicate, provision or deprovision resources of your applications.
CloudFormation stacks are always deployed in a single AWS Account and Region, but you can use CloudFormation StackSets to deploy your templates across multiple AWS Accounts and Regions.
AWS Cloud Development Kit (AWS CDK)
Although CloudFormation provides a flexible mechanism to define cloud infrastructure as code, its use of declarative syntax is not well suited in all situations.
For infrastructure requiring a high number of interrelated services, or that is best defined using iteration, the resulting CloudFormation template can easily grow to hundreds or thousands of lines, which raises its own complications.
The AWS Cloud Development Kit (AWS CDK) (AWS CDK) enables you to define cloud resources in various programming languages, including TypeScript, JavaScript, Python, C#, and Java. Developers use one of the supported languages to write code that defines reusable cloud components known as Constructs, which can then be composed into Stacks and Apps.
After you’ve defined an AWS CDK App, you can use the AWS CDK toolkit to synthesize a CloudFormation template, and then to deploy the defined resources to AWS.
Although using the AWS CDK adds an additional level of complexity to your Infrastructure as Code, by using an imperative language it allows you to work with high-level abstractions, rich logic, and enables the sharing of infrastructure definitions as reusable libraries of components.