Lesson 17 of 30
Clicking through the console to create a bucket works fine — once. The moment infrastructure needs to exist twice, identically, on demand, clicking stops being the answer.
12 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
What does it mean that a CloudFormation template is 'declarative' rather than a script?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
CloudFormation is AWS's declarative infrastructure tool: you write a template (JSON or YAML) describing the resources you want to exist and their configuration, and CloudFormation figures out how to make reality match it — creating, updating, or deleting whatever's needed. Declarative here means the template says what should exist, not the sequence of API calls to run — the same distinction as declarative UI (describe the desired state) versus imperative scripting (describe the steps).
A template deployed becomes a stack — a named, tracked collection of resources CloudFormation manages together as one unit. Delete the stack, and everything it created is torn down with it, which is exactly why a stack is safer to reason about than a pile of manually-created resources nobody's sure they can safely delete.
Resources:
UploadsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: my-app-uploads
VersioningConfiguration:
Status: Enabled
This template, deployed as a stack, creates one versioned S3 bucket. Deploy the identical template again in a staging account and a production account, and both environments get the same bucket configuration — no manual clicking, no environment silently drifting from what the last person who set it up remembered to configure. Before an update actually applies, CloudFormation can generate a change set: a preview of exactly what will be added, modified, or replaced, reviewable before anyone commits to it — the infrastructure equivalent of reviewing a diff before merging.
"How would you make sure staging and production actually have the same infrastructure?" tests whether a candidate reaches for a template-and-stack model with change sets as a review gate, versus manually replicating console clicks and hoping nothing was missed or drifted since.