Infrastructure as code (IaC) is the ability to provision and support your computing infrastructure using code instead of manual processes and settings. Any application environment requires many infrastructure components like operating systems, database connections, and storage. Developers have to regularly set up, update, and maintain the infrastructure to develop, test, and deploy applications.  \n

Manual infrastructure management is time-consuming and prone to error—especially when you manage applications at scale. Infrastructure as code lets you define your infrastructure's desired state without including all the steps to get to that state. It automates infrastructure management so developers can focus on building and improving applications instead of managing environments. Organizations use infrastructure as code to control costs, reduce risks, and respond with speed to new business opportunities.","sortDate":"2023-08-24","headlineUrl":"https://aws.amazon.com/what-is/iac/?trk=faq_card","id":"faq-hub#what-is-infrastructure-as-code","category":"Developer Tools","primaryCTA":"https://portal.aws.amazon.com/gp/aws/developer/registration/index.html?pg=what_is_header","headline":"What is Infrastructure as Code?"},"metadata":{"tags":[{"id":"GLOBAL#tech-category#devtools","name":"Developer Tools","namespaceId":"GLOBAL#tech-category","description":"Developer Tools","metadata":{}}]}}]},"metadata":{"auth":{},"testAttributes":{}},"context":{"page":{"locale":null,"site":null,"pageUrl":"https://aws.amazon.com/what-is/iac/","targetName":null,"pageSlotId":null,"organizationId":null,"availableLocales":null},"environment":{"stage":"prod","region":"us-east-1"},"sdkVersion":"1.0.115"},"refMap":{"manifest.js":"289765ed09","what-is-header.js":"251923df8a","what-is-header.rtl.css":"ccf4035484","what-is-header.css":"ce47058367","what-is-header.css.js":"004a4704e8","what-is-header.rtl.css.js":"f687973e4f"},"settings":{"templateMappings":{"category":"category","headline":"headline","primaryCTA":"primaryCTA","primaryCTAText":"primaryCTAText","primaryBreadcrumbText":"primaryBreadcrumbText","primaryBreadcrumbURL":"primaryBreadcrumbURL"}}}

Infrastructure as code (IaC) is the ability to provision and support your computing infrastructure using code instead of manual processes and settings. Any application environment requires many infrastructure components like operating systems, database connections, and storage. Developers have to regularly set up, update, and maintain the infrastructure to develop, test, and deploy applications.  \n

Manual infrastructure management is time-consuming and prone to error—especially when you manage applications at scale. Infrastructure as code lets you define your infrastructure's desired state without including all the steps to get to that state. It automates infrastructure management so developers can focus on building and improving applications instead of managing environments. Organizations use infrastructure as code to control costs, reduce risks, and respond with speed to new business opportunities.","id":"seo-faq-pairs#what-is-infrastructure-as-code","customSort":"1"},"metadata":{"tags":[{"id":"seo-faq-pairs#faq-collections#infrastructure-as-code","name":"seo-faq-pairs#faq-collections#infrastructure-as-code","namespaceId":"seo-faq-pairs#faq-collections","description":"

infrastructure-as-code","metadata":{}}]}},{"fields":{"faqQuestion":"What are the benefits of infrastructure as code?","faqAnswer":"

Automation is a key goal across any computing environment. Infrastructure as code (IaC) is used for infrastructure automation to create environments. The most common use of IaC is in software development to build, test, and deploy applications. \n

Traditionally, system administrators used a combination of scripts and manual processes to set up infrastructure environments. The process was complex and time-consuming. Today, you can use IaC to automatically set up your environment within minutes and manage it more efficiently. We give some benefits next. \n

Easily duplicate an environment \n

The same environment can be deployed on a different system in another location using the same IaC, as long as the infrastructure resources are available. \n

For example, imagine a business’s regional branch has IaC to describe the whole branch’s enterprise environment, including servers, networking, and custom configurations. If the business opened another regional branch, they could use IaC to duplicate the exact same environment and quickly make the branch online and operational. IaC removes the repetitive manual steps and checklists that were needed in the past. \n

Reduce configuration errors \n

Manual configuration is error-prone due to human involvement. People make mistakes. Or there could be configuration drift due to changes in one setup (like a developer environment) that was missed in another setup (like a test environment). \n

In contrast, IaC reduces errors and streamlines error checking. If there are errors due to IaC code updates, you can quickly fix the situation by rolling the codebase to the last known stable configuration files. It’s also possible to roll back environments using previous versions of IaC configuration files for other reasons, such as the deployment of older application versions. \n

Iterate on best-practice environments \n

Source control allows software developers to easily build and branch on environments. For instance, imagine that an application grew to include an optional machine learning module. A developer could branch the application’s IaC to initiate, use, and stop a high-performance Amazon Elastic Compute Cloud (Amazon EC2) Trn1 instance. They can set the deployment region as dependent on the region of the application deployment.","id":"seo-faq-pairs#what-are-the-benefits-of-infrastructure-as-code","customSort":"2"},"metadata":{"tags":[{"id":"seo-faq-pairs#faq-collections#infrastructure-as-code","name":"seo-faq-pairs#faq-collections#infrastructure-as-code","namespaceId":"seo-faq-pairs#faq-collections","description":"

infrastructure-as-code","metadata":{}}]}},{"fields":{"faqQuestion":"How does infrastructure as code work?","faqAnswer":"

Much like software code describes an application and how it works, infrastructure as code (IaC) describes a system architecture and how it works. An infrastructure architecture contains resources such as servers, networking, operating systems, and storage. IaC controls virtualized resources by treating configuration files like source code files. You can use it to manage infrastructure in a codified, repeatable way.  \n

IaC configuration management tools use different language specifications. You can develop IaC similar to application code in Python or Java. You also write the IaC in an integrated development environment (IDE) with built-in error checking. And you can maintain it under source control with commits at each code change. IaC files are included as part of the wider codebase. \n

Approaches to IaC \n

There are two different approaches to infrastructure as code. \n

Declarative \n

Declarative IaC allows a developer to describe resources and settings that make up the end state of a desired system. The IaC solution then creates this system from the infrastructure code. This makes declarative IaC simple to use, as long as the developer knows which components and settings they need to run their application. \n

Imperative \n

Imperative IaC allows a developer to describe all the steps to set up the resources and get to the desired system and running state. While it isn’t as simple to write imperative IaC as declarative IaC, the imperative approach becomes necessary in complex infrastructure deployments. This is especially true when the order of events is critical.","id":"seo-faq-pairs#how-does-infrastructure-as-code-work","customSort":"3"},"metadata":{"tags":[{"id":"seo-faq-pairs#faq-collections#infrastructure-as-code","name":"seo-faq-pairs#faq-collections#infrastructure-as-code","namespaceId":"seo-faq-pairs#faq-collections","description":"

infrastructure-as-code","metadata":{}}]}},{"fields":{"faqQuestion":"What is the role of IaC in DevOps?","faqAnswer":"

DevOps is the process of improving collaboration between software development and IT operations teams. It aims to shorten the application development lifecycle and provide continuous delivery of high-quality software. DevOps teams integrate operations activities with developer tools and code commits, so applications can have extremely rapid release cycles. \n

A key goal of DevOps is to automate infrastructure tasks across the development process. You can integrate infrastructure as code (IaC) into continuous integration and continuous deployment (CI/CD) pipelines. This way, when software goes through its build and release process, the necessary infrastructure changes can be made in tandem. \n

DevOps teams use infrastructure as code for many purposes: \n

Next Steps on AWS

Check out additional product-related resources
Check out Developer Tools Services 
Sign up for a free account

Instant get access to the AWS Free Tier.

Sign up 
Start building in the console

Get started building in the AWS management console.

Sign in