Node.js › Cloud & DevOps
What is infrastructure as code (IaC), and how might a Node.js team use a tool like Terraform or the AWS CDK alongside their application code?
IntermediateAnswer
IaC defines cloud infrastructure in version-controlled configuration rather than manual console clicks, enabling reproducible, reviewable infrastructure changes. The AWS CDK lets teams define infrastructure using actual TypeScript/JavaScript code rather than a separate declarative language, letting a Node.js team reuse familiar tooling for infrastructure too.
const fn = new lambda.Function(this, 'ApiHandler', {
runtime: lambda.Runtime.NODEJS_20_X,
handler: 'index.handler',
code: lambda.Code.fromAsset('dist'),
});
new apigateway.LambdaRestApi(this, 'Api', { handler: fn });Real-world example A team migrating from manually configured AWS resources to the CDK captures their entire infrastructure as version-controlled TypeScript, letting infrastructure changes go through the same PR review process as application code.