{"head":{"title":"What Is Infrastructure as Code (IaC)? Definition | OceanLab","description":"Infrastructure as code defines servers, networks and databases in files that are versioned and applied by tools. Why it matters, an example and mistakes.","canonical":"https://oceanlab.in/glossary/infrastructure-as-code"},"crumbs":[{"name":"Home","path":"/"},{"name":"Glossary","path":"/glossary"},{"name":"infrastructure as code","path":"/glossary/infrastructure-as-code"}],"slug":"infrastructure-as-code","term":"Infrastructure as code (IaC)","aka":["IaC"],"category":"Hosting and delivery","short":"Defining servers, networks, databases and other cloud resources in code files that are versioned and applied automatically, instead of setting them up by hand.","body":[["With IaC, the cloud setup lives in files in the repository. A tool reads them, compares them with what exists and makes the changes. The same files can create a new environment, rebuild a broken one or show exactly what will change before it happens."],["Changes go through code review and the ",{"href":"/glossary/ci-cd","text":"CI/CD"}," pipeline like any other code, so there is a history of who changed what and why."]],"why":["Hand-built infrastructure drifts, is hard to copy and is lost when the one person who built it leaves. IaC makes environments repeatable, makes disaster recovery practical and gives auditors a clear record of changes. It is also a key part of a clean handover to the client."],"example":["A healthtech client needs a separate copy of its platform in another region for a new customer. Because the whole setup is in code, the team creates the new environment from the same files with region settings changed, instead of rebuilding by hand."],"inBuild":["We define every environment in code from the start, keep secrets in a secrets manager rather than in the files, review planned changes before they are applied and lock production so changes only come through the pipeline."],"mistakes":[["Fixing things by hand in the console, so the code no longer matches reality."],["Storing secrets in IaC files in the repository."],["One giant config for everything, so a small change risks the whole stack."]],"related":[{"href":"/glossary/ci-cd","label":"CI/CD (continuous integration and delivery)","detail":"An automated pipeline that builds and tests every code change (CI) and then releases it to users in a repeatable way (CD)."},{"href":"/glossary/kubernetes","label":"Kubernetes (K8s)","detail":"An open source platform that runs and manages containers across a group of machines: starting them, restarting them, scaling them and routing traffic to them."},{"href":"/glossary/container","label":"Container (software)","detail":"A package that holds an application and everything it needs to run, isolated from other software on the same machine."},{"href":"/glossary/iaas","label":"IaaS (infrastructure as a service)","detail":"Renting raw computing, storage and networking from a cloud provider, while you manage everything that runs on it."},{"href":"/glossary/blue-green-deployment","label":"Blue-green deployment","detail":"A release method that runs two identical production environments and switches all traffic from the old one to the new one in one step."}],"tools":[],"links":[{"href":"/embedded-engineers","label":"Embedded engineers","detail":"OceanLab engineers working inside your team."},{"href":"/pricing/categories/cloud-hosting","label":"Cloud hosting pricing","detail":"Hosting prices side by side, with sources."}],"sources":[],"legal":false,"updatedAt":"2026-10-25"}