What Is Infrastructure as Code?
By the end of this lesson, you'll be able to:
- Explain what Infrastructure as Code means and the problem it solves
- Compare manual console configuration with an Infrastructure as Code approach, including genuine trade-offs of each
- Explain why Infrastructure as Code does not automatically guarantee correctness, security, or low cost
Prerequisites: Module 10: "Exercise: Create a CloudWatch Alarm for an AWS Resource"
The problem manual configuration eventually runs into
Every AWS service this course has covered so far could be created by clicking through the Console — and for exploring a new service or learning a concept, that's a perfectly reasonable way to work. The trouble shows up at a different point: once an environment needs to be reproduced — a second environment for testing, a disaster-recovery rebuild, or simply remembering exactly what was configured six months ago — manual, one-off Console actions become genuinely hard to reproduce exactly, hard to review before they happen, and easy to leave undocumented. Two environments built "the same way" by hand often end up subtly different without anyone intending it.
Infrastructure as Code: describing what should exist
Infrastructure as Code (IaC) means defining infrastructure in a template — a file describing what AWS resources should exist and how they should be configured — instead of performing the equivalent actions by hand in the Console. That template can be version-controlled, reviewed before it's applied, and reused to create the same infrastructure again, consistently.
IaC doesn't guarantee correctness, security, or low cost
This is worth stating directly, because the benefits of IaC can make it feel like a complete solution on its own: a template can be reviewed, version-controlled, and repeatable, and still describe genuinely bad infrastructure. A template with an overly broad IAM policy deploys that overly broad policy every single time, consistently. A template that provisions far more capacity than a workload needs does so repeatably, not just once. Infrastructure as Code is a discipline for how infrastructure gets defined and changed — it doesn't replace the architectural, security, and cost judgment this course has spent ten modules building.
Declarative: what should exist, not a script of steps
This course's central Infrastructure as Code service, covered starting next lesson, is built around a declarative model: a template describes what infrastructure should exist — an S3 bucket, a queue, an IAM role — rather than scripting the exact low-level sequence of API calls needed to create them. The deployment engine itself works out an appropriate process for creating or updating those resources, based on their dependencies and how each service actually behaves. This lesson doesn't assume that process always happens in one single fixed order — the next few lessons build up exactly how that determination gets made.
Exercise
A team has built their staging environment by hand in the Console, and now needs to build an identical production environment. Using this lesson's reasoning, explain one concrete way the manual approach makes this harder than it needs to be, and what specifically an Infrastructure as Code approach would change about that. Then explain why simply "having a template" wouldn't guarantee the resulting infrastructure is secure.
Show hint
Think about what's hard to reproduce exactly by hand, and separately, what a template can and can't tell you about whether its contents are actually a good design.
What Is Infrastructure as Code? Quiz
My Notes
Log in to keep private notes on this lesson.
Questions about this lesson
No questions yet — be the first to ask.
Log in to ask a question about this lesson.
Summary
Infrastructure as Code means defining AWS infrastructure in a template — a file that describes what should exist — rather than relying entirely on manual, one-off Console actions; this improves repeatability, reviewability, and consistency, but it does not by itself guarantee the infrastructure it defines is correct, secure, or inexpensive.