liveBook · Manning

Infrastructure as code

As explained in Secure APIs

Infrastructure as code is the management of infrastructure through machine-readable code rather than exclusively through manual configuration.

Infrastructure as code (IaC) manages infrastructure through machine-readable code, making configurations repeatable across environments instead of relying on manual changes. section 1.2.3

Use IaC to make infrastructure more consistent and testable:

  • Replicate infrastructure accurately across environments. section 1.2.3
  • Choose provider-specific tools such as CloudFormation or Azure Resource Manager, or use Terraform across multiple clouds. section 1.2.3
  • Audit and test configuration with static analysis tools such as tfsec. section 1.2.3
  • Combine IaC with automated, repeatable deployment pipelines to prevent random manual changes. section 5.4

A safer deployment check

A deployment pipeline applies the infrastructure definition consistently, then runs smoke tests that check for exposed stack traces and incorrectly configured CORS headers. section 5.4

Figure 5.6 A common consequence of security misconfiguration is leaking stack traces in error responses. Stack traces often reveal sensitive information about our internal system configuration, and threat actors can exploit this information to design better strategies to break into our system.
figure

Use the figure to see how a configuration mistake can expose stack traces and reveal internal system details to attackers. section 5.4

How Secure APIs covers it

How deep it goes
Explains automation, tool choices, static analysis, and deployment checks, but does not detail IaC syntax.
Examples
Uses CloudFormation, Azure Resource Manager, Cloud Builder, Terraform, tfsec, and deployment smoke tests.
What you can do after
Operate and configure infrastructure consistently, then audit and test it for common security misconfigurations.
How it connects
Connects infrastructure as code with secure configuration, deployment pipelines, static analysis, smoke testing, and cloud deployment.

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 Secure APIs. The section links point to the parts of the book it draws on.