ELI5: What Is Infrastructure As Code (IaC)???

r/

I studied data science in school which meant I did study some CS, but mostly it was just DSA and some programming language stuff as well as basics such as MANTISSA and finite automata/NFA, pass by and all that. I don’t have any idea whatsoever when it comes to hardware, and really not much when it comes to software stacks. The orojects I’ve done that did have a frontend and backend were very basic. Infrastructure and IT are just a complete and utter mystery to me.

Why do we need stuff like Terraform, for instance?

Comments

  1. drewkawa Avatar

    Alright, imagine you have a giant box of LEGO.

    You want to build a cool city with houses, roads, cars, and people. You could build it one brick at a time, but it would take forever, and you might mess up or forget how you did it last time.

    Now imagine you have a magic book that says, “When I say ‘build city,’ you instantly get all the houses, roads, and cars set up exactly how I like it.”

    That magic book is what Terraform does—but for computers instead of LEGO.

    Instead of clicking around and setting up servers, databases, and tools by hand, Terraform lets you write it down in a file and then builds everything for you—the same way every time.

    It’s like telling the cloud, “Hey, give me 3 houses (servers), 1 car (a database), and a road (a network),” and it just does it.

    So we use Terraform because:
    • It’s faster
    • It’s less confusing
    • It makes sure everything is done the same way, every time

    Even grown-up computer people use it because remembering all the buttons to press is really hard when the LEGO city gets huge.

  2. cipheron Avatar

    https://aws.amazon.com/what-is/iac/

    > Infrastructure as code (IaC) is the ability to provision and support your computing infrastructure using code instead of manual processes and settings. Infrastructure as code (IaC) is the ability to provision and support your computing infrastructure using code instead of manual processes and settings.
    >
    > 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.

    The first thing be aware of is that by “infrastructure” here they mostly mean deployments of server resources. The “code” part means being able to write scripts that automatically configure or deploy resources for you. Having to do everything manually to change configurations would be time consuming, not responsive and error prone, so if you’re able to configure some scripts that handle this for you it means you don’t need to manually type a lot of stuff in, possibly messing up.

    They outline two types “declarative IaC” means to outline what you want, and the “code” works out how to go about meeting your requirements vs “imperative IaC” in which case you outline a procedure you want carried out, including the step by step instructions. The second one gives you more control over the outcome but you need to do more work to create it and make sure it’s correct, whereas the first one is more error-proof but you can’t customize the process as much.

    In reality you’d probably have a mix of declarative (vaguely saying what outcomes should happen) and imperative (detailed instructions for specific circumstances) code handling your deployments.