liveBook · Manning

Infrastructure as code

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

Infrastructure as code is the practice of defining and provisioning computing infrastructure through machine-readable code or declarative configuration.

Infrastructure as code defines and provisions infrastructure through code or declarative configuration. On AWS, it can describe networks, virtual machines, load balancers, DNS entries, storage, and databases, then automate their creation and modification. section 1.3.3 section 4.4

Figure 4.1 The AWS cloud is composed of hardware and software services accessible via an API.

AWS exposes hardware and software services through an API; infrastructure as code turns that programmable foundation into repeatable infrastructure definitions. section 4.0

Use the AWS automation layer that matches the task:

  • Run the command-line interface from a terminal, including scripts written in Bash or PowerShell. section 4.0 section 4.6
  • Use an SDK from a supported programming language to embed AWS operations in an application. section 4.0 section 4.6
  • Use CloudFormation templates in JSON or YAML to declare the desired infrastructure state; CloudFormation resolves the required API calls. section 4.0 section 4.6
  • Apply software-development practices such as code repositories, automated tests, and build servers to infrastructure definitions. section 4.4

Changing an EC2 instance type

With imperative commands, stop the EC2 instance, wait, change its type, start it, and wait again. With CloudFormation, change the InstanceType property in the template and update the stack. A template can accept the instance type as a parameter, while the resulting deployed environment is called a stack. section 4.5.2

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Defines infrastructure, contrasts imperative and declarative control, and walks through an EC2 CloudFormation stack without covering later networking details.
Examples
Uses AWS resource blueprints, an EC2 template, parameters, and a CloudFormation stack update that changes an instance type.
What it assumes
Assumes basic AWS resource awareness while teaching API-driven control and distinguishing Infrastructure as Code from Infrastructure as a Service.
What you can do after
Operate/configure AWS infrastructure reproducibly with CLI scripts, SDK code, or declarative CloudFormation templates.
How it connects
Connects AWS APIs, command-line interfaces, SDKs, CloudFormation, virtual machines, networking, storage, and software development practices.

Also explained in

Compare how 14 books explain infrastructure as code →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.