What is AWS CloudFormation?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid AWS / Cloud Computing basics — a prerequisite for any developer role.

Answer

AWS CloudFormation is Infrastructure as Code (IaC) — define and provision AWS infrastructure using declarative JSON or YAML templates. Create, update, and delete a collection of resources as a single unit called a stack. Template structure: AWSTemplateFormatVersion: "2010-09-09" Description: "Web App Stack" Parameters: Environment: Type: String AllowedValues: [dev, prod] InstanceType: Type: String Default: t3.micro Resources: WebServer: Type: AWS::EC2::Instance Properties: ImageId: ami-0abcdef1234567890 InstanceType: !Ref InstanceType SecurityGroups: [!Ref WebSecurityGroup] UserData: !Base64 | #!/bin/bash yum install -y httpd systemctl start httpd WebSecurityGroup: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: Allow HTTP/HTTPS Outputs: WebServerURL: Value: !Sub "http://${WebServer.PublicDnsName}". Key features: !Ref (reference a resource/parameter), !Sub (string substitution), !GetAtt (get resource attribute), !Join, !Select, !If (conditional). StackSets: deploy stacks across multiple accounts and regions. Change sets: preview changes before applying. Drift detection: detect configuration changes made outside CloudFormation. Nested stacks: template that references other templates. AWS CDK (Cloud Development Kit): define infrastructure in Python, TypeScript, Java — generates CloudFormation. Higher-level abstractions. Terraform: popular third-party IaC, multi-cloud, uses HCL language.

Common Mistake

A common mistake is memorizing definitions without understanding implications. When asked this question, go one level deeper — explain what happens when this concept is misused or ignored.