What is a CloudFormation stack - one folder, many resources

Logeshwaran.C

A CloudFormation stack is a single named unit AWS creates from one template file — instead of clicking around the console building a server here and a database there, you write down everything you want in one YAML or JSON document, hand it to CloudFormation, and it builds every resource in that "folder" together, tracks them as a group, and lets you update or tear the whole thing down with one command. Here's the part almost nobody mentions until it costs them money: that "folder" isn't a filing cabinet you can just close and forget. The resources inside are real, running, billable AWS infrastructure, and AWS keeps charging you for every one of them for as long as they existed — even if you delete the stack sixty seconds after creating it.

⚡ Quick Answer

What it is → a collection of AWS resources (servers, databases, buckets, permissions, whatever you listed) that CloudFormation manages as one single unit, created from one template file.

Why it matters → one command creates everything, one command updates everything, one command deletes everything — no clicking through a dozen different AWS service consoles by hand.

Think "one folder, many resources" — but a folder that can bill you and break in ways a real folder never could. Jump to the full explanation or the stack lifecycle table if you're troubleshooting a stuck stack right now.

What is a CloudFormation stack, really?

AWS's own documentation puts it plainly: a stack is a collection of AWS resources that you can manage as a single unit. In other words, you create, update, and delete a whole group of resources by creating, updating, and deleting one stack — not by touching each resource one at a time.

Creating a stack means deploying a CloudFormation template that lists the resources you want and how they should be configured; CloudFormation reads that list and provisions everything for you. Updating a stack means changing the template or its parameters — CloudFormation compares what you're asking for against what currently exists, and only touches the resources that actually changed. Deleting a stack removes every resource that belongs to it. If a web app needs a server, a database, and a set of networking rules, all three live inside one stack, and getting rid of the app is as simple as deleting that one stack — CloudFormation deletes all three resources along with it.

‍♂️ Jake's Reality Check

"So a 'stack' is just... a folder of servers? Why does AWS need a whole extra service to do that? Can't I just build the server and the database myself and remember they go together?"

You can, and for a while it'll even work. Right up until you're managing forty resources across three environments and you're the only person who remembers which security group belongs to which app. A stack isn't magic — it's a receipt. It's the one place CloudFormation writes down exactly what it built, so it (and you, and whoever inherits your job) can find it again.

Jake found this out the expensive way. He'd set up a customer-facing order form on EC2 for his phone shop — one instance, one small database, one load balancer, all clicked together by hand over a lazy Sunday afternoon. Eight months later he needed to shut it down because he'd switched to a point-of-sale app instead. He deleted the instance. He forgot the load balancer. It sat there, billing him $16 a month, for eleven months before his accountant noticed the line item. A stack would have deleted all three resources the moment he asked it to — because CloudFormation, not Jake's memory, was keeping the list.

The "one folder, many resources" idea, and where it breaks down

The folder metaphor is useful for exactly one thing: it explains grouping. Everything you put in the template ends up inside the same stack, the same way every file you drag into a folder ends up under the same name. That's where the resemblance ends, and it's worth being precise about the difference, because the places it breaks down are exactly the places people get burned.

A folder holds files. A stack holds live infrastructure.

Deleting a folder on your laptop removes references to files sitting quietly on a disk. Deleting a stack sends real delete commands to real AWS services — it terminates EC2 instances, drops database instances, empties (or fails to empty, depending on settings) S3 buckets. Nothing in a stack is inert. Every resource inside one is doing something, and often billing you for doing it, the entire time the stack exists.

A folder doesn't enforce consistency. A stack does — brutally.

You can drop a half-finished file into a folder and nothing happens. A stack has no equivalent of "half-finished." CloudFormation treats every resource in a stack as a single all-or-nothing unit: they must all be created (or all deleted) successfully for the operation to count as done. If one resource fails partway through, CloudFormation automatically rolls the whole stack back and removes anything it had already created — you don't end up with three working resources and one broken one sitting in your account.

✅ Why this is the one habit worth building early

Group resources in a stack by lifecycle and ownership, not by convenience. If two resources are always created, updated, and deleted together — a Lambda function and the IAM role it assumes, say — they belong in the same stack. If one resource (a shared VPC, a long-lived database) needs to outlive everything built on top of it, it belongs in its own stack. Mixing "temporary experiment" resources into the same stack as "permanent production" resources is the single most common way people end up afraid to ever delete anything.

Stack vs. template vs. change set vs. StackSet

This is where almost every beginner explanation trips over itself, because AWS uses four related terms and the differences matter for how you actually operate. Here's the plain version, with no jargon left unexplained.

A template is the recipe: a text file, written in JSON or YAML (two plain-text formats for describing structured data — think of YAML as a recipe card with indentation instead of a paragraph, and JSON as the same recipe typed with curly braces), that lists every resource you want and how it should be configured. The template itself doesn't create anything by sitting on your laptop. It's inert until you hand it to CloudFormation.

A stack is what you get when CloudFormation actually deploys that template — the running, billable, real-world result. One template can be used to create many stacks (a "dev" stack and a "prod" stack from the identical template, for example), and each one is tracked, billed, and managed completely separately, even though they came from the same recipe.

A change set is a preview. Before CloudFormation touches a running stack, you can ask it to generate a change set — a summary of exactly what it's about to add, modify, or delete — and review it before anything actually happens. It's the difference between a contractor showing you blueprints of the wall they're about to knock down and a contractor just showing up with a sledgehammer.

A StackSet is a stack multiplier. It takes one template and deploys it as a stack in many AWS accounts and many AWS Regions at once, from a single operation. If you manage infrastructure for an organization with fifty AWS accounts and need the same baseline security setup in every one of them, you don't create fifty stacks by hand — you create one StackSet, and it creates and manages a stack in each target account and Region for you.

Term What it actually is How many can exist
Template A YAML/JSON text file describing resources One file, reused any number of times
Stack The deployed, running result of a template Many stacks per template, per account, per Region
Change set A preview of what an update would do to one stack Disposable — review it, then execute or discard it
StackSet One template deployed as stacks across many accounts/Regions Each target account+Region pair gets its own stack instance

What actually goes inside a stack

A stack is built from a handful of parts, and understanding each one makes the rest of this post much easier to follow.

Resources

These are the actual AWS things: an EC2 instance, an S3 bucket, an IAM role, an RDS database. Each one is declared in the template with a logical name (a name you invent, used only inside the template) and a resource type (AWS's official name for that kind of thing, like AWS::S3::Bucket). This is what people mean by "the resources in the stack."

Parameters

Values you can plug into a template at the moment you create or update the stack — an instance type, an environment name, a password — without having to rewrite the template itself. The same template, given different parameter values, can produce a small "dev" stack and a much larger "prod" stack.

Outputs

Values the stack exposes once it's finished — the URL of a load balancer it just created, the ARN (Amazon Resource Name — AWS's unique ID format for a resource, similar to a street address that pinpoints exactly one building) of a database it just provisioned. Other stacks, or you, can read these outputs afterward instead of hunting through the console for them.

Stack events and stack resources

CloudFormation keeps a running log of everything it does to a stack — every resource it starts creating, every one that succeeds, every one that fails and why — retrievable at any time. This event log is usually the very first place to look when something goes wrong, well before you go digging into individual AWS service consoles.

How a stack is born: creation and the all-or-nothing rule

Creating a stack from the console follows the same basic sequence no matter which interface you use — console, AWS CLI, PowerShell, an SDK, or the AWS CDK (a framework that lets you write infrastructure in a real programming language and have it generate a CloudFormation template for you behind the scenes).

  1. Sign in to the AWS Management Console and open the CloudFormation console.
  2. Choose Create stack and point CloudFormation at your template — you can upload a file, paste it directly, or reference one already stored in an Amazon S3 bucket.
  3. Give the stack a name and fill in any parameters the template asks for.
  4. Review the summary, acknowledge any IAM-related capabilities the template needs (CloudFormation asks for explicit acknowledgment before it's allowed to create resources that grant permissions, as a safety check), and choose Submit.
  5. Watch the Events tab. CloudFormation works through resources in dependency order, marking each one CREATE_IN_PROGRESS and then CREATE_COMPLETE as it finishes.

What happens if step 5 goes wrong for even one resource? This is the detail that separates CloudFormation from clicking things together manually, and it's worth sitting with. CloudFormation ensures all stack resources are created or deleted as appropriate — because it treats the resources as a single unit, they all have to succeed for the stack creation to count as successful. If a resource can't be created, CloudFormation rolls the stack back and automatically deletes anything it had already created moments earlier. You don't wake up to three resources you wanted and one silent failure sitting next to them; you either get the whole stack, or you get nothing.

⚠️ What this actually breaks

Automatic rollback deletes resources — but it can't delete money already spent. If a resource ran for four minutes before the stack failed and rolled back, you're billed for those four minutes. A stack that fails on creation ten times in a row while you debug a typo is ten small charges, not zero. We can't undo billed compute time after the fact — nobody can — so the cheapest fix is always catching the typo in a change set before it ever runs.

The stack lifecycle: every status code, explained in English

Every stack sits in exactly one status at any given moment, and CloudFormation shows you that status right at the top of the stack's page in the console. Most confusion about "stuck" stacks comes down to not knowing what a status actually means. Here's the full table, straight from what each status represents.

Status What it means Can you act on it?
CREATE_IN_PROGRESSResources are actively being createdWait; you can watch the Events tab
CREATE_COMPLETEEvery resource created successfullyStack is live and healthy — update or use it
CREATE_FAILEDAt least one resource failed to createCheck stack events for the specific error
ROLLBACK_IN_PROGRESSUndoing a failed or canceled creationWait for it to finish
ROLLBACK_COMPLETEFailed creation was fully cleaned up; resources from the attempt are goneOnly a delete is allowed — you cannot update from here
ROLLBACK_FAILEDCleanup itself failedDelete the stack, or inspect events for the blocking resource
UPDATE_IN_PROGRESSAn update is being appliedWait; some updates can be canceled
UPDATE_COMPLETE_CLEANUP_IN_PROGRESSUpdate succeeded; CloudFormation is removing old, replaced resourcesWait for it to finish
UPDATE_COMPLETEUpdate fully appliedStack is live and healthy
UPDATE_ROLLBACK_IN_PROGRESSA failed update is being undoneWait for it to finish
UPDATE_ROLLBACK_COMPLETEFailed update was undone; stack is back to its last working stateYou can try updating it again
UPDATE_ROLLBACK_FAILEDThe undo itself failedFix the blocking resource, then continue the rollback manually
DELETE_IN_PROGRESSResources are actively being removedWait for it to finish
DELETE_COMPLETEStack and all its resources are goneStack no longer exists
DELETE_FAILEDAt least one resource refused to deleteRemaining resources are retained until you resolve the blocker

The one that trips people up most is ROLLBACK_COMPLETE versus UPDATE_ROLLBACK_COMPLETE — they sound almost identical, but they behave very differently. ROLLBACK_COMPLETE only ever happens after a stack creation failed; because the stack never successfully finished being created in the first place, CloudFormation only lets you delete it from that state — there's no "last working version" to fall back to, because there never was one. UPDATE_ROLLBACK_COMPLETE happens after an update to an already-working stack fails; because the stack did have a working version before you touched it, CloudFormation restores that version and lets you try updating again once you've fixed whatever broke.

 What changed between versions

  • Before: a stack stuck in a failed update state with no working recovery command could often only be fixed by manually editing resources or asking support for help.
  • Now: ContinueUpdateRollback lets you continue rolling a stack forward from UPDATE_ROLLBACK_FAILED to UPDATE_ROLLBACK_COMPLETE yourself, and the newer RollbackStack action can roll a stack back from CREATE_FAILED or UPDATE_FAILED directly, without waiting for CloudFormation's automatic rollback to kick in first.
  • What that means for you: a stuck stack today is almost always self-service, provided you can identify and fix the specific resource that's blocking the rollback.

Updating a stack: change sets vs. direct updates

Updating a stack means changing its template or its parameters. CloudFormation compares what you're submitting against what's currently deployed and only touches the resources that actually changed — it doesn't tear down and rebuild the whole stack every time you tweak one setting. But "only touches what changed" hides an important wrinkle: depending on exactly which property you change, CloudFormation might update a resource quietly in place, briefly interrupt it, or replace it entirely with a brand-new resource (which usually means a brand-new resource ID, and can mean lost data if you weren't expecting it).

Also Read:

 

CloudFormation gives you two ways to apply an update:

Change sets — look before you leap

A change set is a JSON-formatted summary of exactly what CloudFormation intends to do to your stack: which resources it will add, which it will modify, which it will delete, and — critically — whether a modification means an in-place update or a full replacement. You generate the change set, read it, and only then decide whether to execute it. This is the tool for confirming, before it happens, that CloudFormation isn't about to quietly replace your production database.

Direct updates — for when you trust the change

A direct update skips the preview: you submit the new template or parameters, and CloudFormation deploys immediately. It's faster, and it's the reasonable choice for small, well-understood changes you've made a hundred times before.

  1. Open the stack in the CloudFormation console and choose Update.
  2. Choose whether to replace the current template, edit it directly, or use the existing one and only change parameters.
  3. To preview first, choose Create change set instead of updating directly; review the listed changes before choosing Execute change set.
  4. Watch the Events tab as before — CloudFormation applies updates in dependency order, same as creation.

‍♂️ Jake's Reality Check

"If I mess up a change set, does CloudFormation just carry on and hope for the best?"

No — and this is the whole point of it. A change set doesn't touch a single resource until you explicitly execute it. You can generate ten of them, throw nine away, and only run the one that looks safe.

Ethan puts it more bluntly to Jake than the documentation ever would: "Direct updates are for the changes you've made a hundred times. Change sets are for the ones where you're not 100% sure what CloudFormation's about to do — and if you're honest with yourself, that's most of them." He's not exaggerating for effect. Skipping the preview on a change you assumed was "just adding a tag" is exactly how people discover, mid-deploy, that changing one property on a resource silently forces a full replacement.

Express mode: the newest way to speed both of these up

CloudFormation express mode lets create, update, and delete operations complete as soon as the resource's configuration is applied, instead of making you wait for the resource to fully stabilize the way the default deployment mode does. In the default mode, creating an EC2 instance means CloudFormation waits until that instance is actually in the running state before it calls the operation done. In express mode, CloudFormation typically marks the operation complete the moment the underlying API call succeeds — the resource keeps settling into its final state in the background afterward. It works with existing templates, needs no template rewrite, and applies to nested stacks automatically once you turn it on for the parent.

AWS is explicit about where this belongs: use express mode when you're iterating quickly on template changes and speed matters more than confirming full stabilization; use the default mode for production deployments where you genuinely need to know resources are fully operational before you consider the deployment finished. Ethan's version for Jake: "Express mode is for the fifteenth time you deploy the same broken Lambda function today. It's not for the one deploy your Saturday customers are waiting on."

Deleting a stack — and what actually happens to your data

Deleting a stack deletes every resource it manages. That's the entire point of the folder model — one delete, everything's gone — but it also means a single click can remove a database with real customer data in it if you weren't paying attention. CloudFormation ensures the resources are all deleted successfully for the stack deletion to count as complete; if a resource can't be deleted, whatever's left is retained until you resolve the problem, rather than being force-removed.

What controls whether a specific resource is actually destroyed, retained, or backed up first is a per-resource setting called DeletionPolicy. By default, most resources use Delete — gone with the stack, no trace. You can instead set DeletionPolicy: Retain on anything you want to survive stack deletion — a production S3 bucket or database, for instance — which tells CloudFormation to disconnect the resource from the stack rather than destroy it. Some resource types also support Snapshot, which takes a backup before deleting.

⚠️ What this actually breaks

A resource with the default Delete policy is destroyed the moment the stack it belongs to is deleted, with no confirmation prompt asking "are you sure this database has real data in it." If you didn't explicitly set Retain or Snapshot on your database or storage resources before deleting a production stack, that data is gone — CloudFormation did exactly what it was told, which is precisely the problem. There's no recycle bin to fish it back out of afterward.

And here's a detail that catches even experienced teams off guard: you are billed for the time your stack's resources were actually running, regardless of when you delete the stack. Spin up an expensive database instance by accident, notice within two minutes, and delete the stack immediately — you're still charged for those two minutes of that database's runtime. The stack's lifetime and your bill's lifetime aren't quite the same thing.

The adjacent task: checking exactly what's in a stack before you touch it

Before you delete or heavily update any stack you didn't build yourself, it's worth thirty seconds to see what's actually inside it — Jake's load-balancer mistake happens to people with years of experience too, usually on someone else's stack.

  1. Open the CloudFormation console and choose the stack you're about to touch.
  2. Go to the Resources tab to see every resource the stack manages, its logical name, and its current status.
  3. Go to the Outputs tab to see anything the stack exposes for other stacks or people to use — a value in here being referenced elsewhere is a sign something else depends on this stack.
  4. Check the Template tab to see the current template CloudFormation has on file — this is the authoritative version, not whatever's sitting in your local folder, which may be out of date.

When one folder isn't enough: nested stacks

As templates grow, you'll find yourself copying the exact same configuration — a load balancer setup, a networking layout — into template after template. Nested stacks solve this by letting you pull that repeated configuration into its own dedicated template, and then reference it from inside other templates using a special resource type, AWS::CloudFormation::Stack. When the parent template is deployed, CloudFormation deploys the referenced template as its own separate, nested stack underneath it.

Nested stacks can themselves nest further nested stacks, which produces a hierarchy. The root stack is the top-level stack that every other stack in the hierarchy ultimately belongs to. Each nested stack also has an immediate parent stack — for the first layer of nesting, the parent and the root are the same stack; for deeper layers, they're different. If stack A contains nested stack B, which contains nested stack C, stack A is the root stack for everything, but stack B is specifically the parent of stack C.

There's an operational rule worth internalizing before you build a nested hierarchy: updates and most other stack operations should be started from the root stack, not run directly against a nested stack underneath it. Updating the root stack only touches the nested stacks whose underlying template actually changed — it doesn't blindly redeploy every nested stack every time. And if one nested stack gets stuck rolling back, the root stack will wait until that nested stack completes its rollback before it continues, so make sure you have permission to cancel a stuck update before you start one.

Nested stacks are not the same thing as multiple independent stacks

A nested stack is tightly coupled to its parent — it's created, updated, and deleted as a consequence of operations on the parent, and it shows up under the parent in the console with a "NESTED" label. Two independent stacks that happen to reference each other's outputs are a looser relationship: each one can be updated or deleted on its own schedule, which is usually what you want for resources with genuinely different lifecycles, like a shared network layer that outlives every application built on top of it.

Drift: when reality stops matching the folder

Nothing stops someone from opening the EC2 console and manually changing a setting on an instance that a CloudFormation stack created. When that happens, the stack's template still describes the old configuration, but the real resource no longer matches it — this mismatch is called drift. A resource has drifted if any of its actual, live property values differ from what the template expects, including if the resource has been deleted outright from underneath the stack.

You can run drift detection on an entire stack, or on individual resources within it, and CloudFormation reports back one of three statuses: IN_SYNC (matches perfectly), DRIFTED (something doesn't match), or NOT_CHECKED (either drift detection hasn't been run yet, or that particular resource type doesn't support it). Not every AWS resource type supports drift detection, and CloudFormation only checks properties you actually set explicitly in the template or via parameters — it doesn't track a resource's default values you never specified.

Drift detection matters for one very practical reason: it quietly explains updates that "shouldn't" have done what they did. If someone manually resized a database that a stack manages, and you later run a stack update that touches an unrelated setting, CloudFormation may treat the manually-changed property as needing to be corrected back to what the template says — surprising anyone who didn't know the drift existed in the first place. It's also worth knowing drift detection on a stack does not automatically check any nested stacks underneath it — you have to run drift detection on those separately, one nested stack at a time.

Protecting the folder: three layers, not one

People often reach for a single safety switch and assume it covers everything. In reality, CloudFormation offers three separate protections, each covering a different mistake, and none of them substitute for the others.

Termination protection — stops the whole stack from being deleted

Enable this on a stack and any attempt to delete it — from the console, the CLI, or the API — fails outright until someone deliberately turns termination protection off first. It's a deliberate speed bump against the "wrong environment, wrong stack, hit delete" mistake.

Stack policies — stop specific resources from being changed during an update

A stack policy is a JSON document you attach to a stack that governs what update operations are allowed on which resources — you might allow updates to everything except one named database resource, denying its replacement or deletion specifically, while still allowing lower-risk changes elsewhere. Note the scope: a stack policy only governs behavior during stack update operations. It does nothing to stop the stack from being deleted outright, and it doesn't stop someone with the right permissions from changing the resource directly through its own service console.

DeletionPolicy — stops one resource from being destroyed even if the stack is

As covered earlier, this is set per-resource, inside the template. Retain keeps the resource alive (just disconnected from CloudFormation) even if the whole stack is deleted; Snapshot backs it up first where the resource type supports it.

✅ Why you want all three on anything that matters

None of these three overlaps with the other two. Termination protection stops the whole stack from being deleted by accident. A stack policy stops one resource from being replaced or deleted during a routine update. DeletionPolicy: Retain is the last line of defense if someone deletes the stack anyway with the right permissions. Production infrastructure earns all three, not just whichever one you remembered first.

Enabling termination protection takes seconds: open the stack in the console, choose Stack actions, then Edit termination protection, and turn it on. From the AWS CLI, the equivalent is the update-termination-protection command with --enable-termination-protection pointed at your stack name.

The privacy and safety angle: what a stack's permissions can quietly grant

Before you launch a stack, it's worth asking who or what can act on it, not just what it builds. CloudFormation requires IAM (Identity and Access Management — the service that decides who's allowed to do what in your AWS account) capability acknowledgment specifically because some templates create resources that grant permissions, like new IAM roles or users — and a template you didn't fully read could hand out more access than you intended. Applying the principle of least privilege to whoever's allowed to run cloudformation:CreateStack, UpdateStack, or DeleteStack in the first place is the layer above everything else in this section — a perfectly protected stack is still only as safe as the people with permission to touch CloudFormation itself.

Scaling the folder: StackSets across accounts and Regions

A single stack lives in one AWS account and one AWS Region. That's fine for a personal project, but it breaks down fast for an organization running dozens of accounts across multiple Regions that all need the same baseline setup — a standard IAM role, a mandatory logging configuration, a security guardrail. Recreating that by hand in every account is exactly the kind of repetitive, error-prone work CloudFormation was built to eliminate in the first place, so AWS extended the stack concept with StackSets.

An administrator account is the account where you create the StackSet itself. A target account is any account into which the StackSet creates, updates, or deletes actual stacks. Each account-Region combination the StackSet touches is called a stack instance, and each stack instance corresponds to a genuine, individual CloudFormation stack running in that account and Region — created from the same shared template, but able to be customized per-instance using parameters.

StackSets support two permission models. With self-managed permissions, you personally create the IAM roles needed to establish trust between the administrator account and each target account. With service-managed permissions, StackSets integrates directly with AWS Organizations, and can automatically deploy to new accounts the moment they're added to a target organizational unit — no manual role setup required each time.

‍♂️ Jake's Reality Check

"My cousin runs three phone repair shops now, each with its own little inventory site. Does he need three separate stacks, or is this the StackSet thing?"

If all three sites use the same setup and live in the same AWS account, one stack per shop is usually simpler than it sounds — three stacks from one template, deployed with three different parameter values. StackSets earns its keep once he's managing separate AWS accounts per shop, or needs a change rolled out to all three without logging into each one by hand.

Use a plain stack when Use a StackSet when
You're deploying to one account and one RegionYou need the same setup across many accounts or Regions
You're building an application's own resourcesYou're rolling out an organization-wide baseline or guardrail
You want fine-grained, per-stack control over timingYou want one operation to update dozens or hundreds of stacks consistently

Automation for the power user, once the basics are second nature

Everything above works fine from the console for one or two stacks. Once you're managing more than that, three tools carry most of the day-to-day weight. The AWS CLI gives you a full command line vocabulary for stacks — create-stack, update-stack, delete-stack, describe-stacks, and their equivalents for change sets and drift detection — which is what lets you script deployments instead of clicking through them by hand. The AWS Cloud Development Kit (CDK) lets you author infrastructure in an actual programming language like TypeScript or Python, and synthesizes an ordinary CloudFormation template underneath, so everything covered in this post — stacks, nested stacks, change sets, drift — still applies exactly the same way; the CDK doesn't replace CloudFormation, it generates its input. And CloudFormation also supports Git sync, which lets you store a template in a Git repository and have stack updates driven directly from commits to a branch, instead of manually specifying an S3 URL or uploading a file each time you deploy.

The limits nobody reads until they hit them

Every AWS account has CloudFormation quotas — hard ceilings you can bump into while your template is otherwise perfectly correct. Knowing them up front saves you from redesigning a template halfway through a deployment.

Quota Value Way around it
Resources per stack500 resourcesSplit into nested stacks or separate stacks by lifecycle
Resources per nested-stack operation2,500 resourcesSpread very large hierarchies across more nested stacks
Stacks per Region per account2,000 stacksDelete unneeded stacks, or request a quota increase via AWS service quotas
Stack name length128 charactersShorten it; the limit is fixed
Parameters per template200 parametersGroup related settings into nested stacks with their own parameters
Outputs per template200 outputsExport only what other stacks genuinely need to consume
Mappings per template200 mappingsSplit the template into multiple templates, e.g. via nested stacks
Stack sets per administrator account1,000 stack setsDelete unused stack sets or request an increase
Stack instances per stack set100,000 stack instancesRarely hit outside very large organizations

 What changed between versions

  • Before: the per-template resource limit was 200 resources, and the parameter, mapping, and output limits were roughly a third of today's figures.
  • Now: AWS raised the resources-per-template limit to 500 and lifted parameters, mappings, and outputs to 200 each, alongside a larger maximum template size, so a single template can model considerably more of an application than it used to.
  • What that means for you: hitting the 500-resource ceiling on a modern account is a genuine sign it's time to split the template, not a symptom of doing something wrong.

The 500-resource limit is exactly why nested stacks exist as a design pattern, not just a tidiness preference. If your application genuinely needs more than 500 distinct resources, splitting it into logical nested stacks — networking in one, compute in another, data storage in a third — isn't a workaround, it's the intended way to model something that large.

Myths worth retiring

"CloudFormation costs extra." It doesn't — CloudFormation itself has no separate service charge. You pay only for the underlying resources the stack creates (the EC2 instances, the databases, the storage), exactly as you would if you'd built them by hand. The "cost" of CloudFormation is entirely the cost of what you told it to build.

"A stuck stack means you have to contact AWS support." Rarely true anymore. Between ContinueUpdateRollback for a failed rollback and RollbackStack for rolling a failed create or update back manually, most stuck states are self-serviceable once you've found and fixed the specific resource causing the block.

"Deleting a stack is reversible if you act fast." It isn't, unless you set DeletionPolicy: Retain or Snapshot in advance on the resources you cared about. CloudFormation doesn't keep a recycle bin.

"Nested stacks and StackSets solve the same problem." They solve opposite-shaped problems. Nested stacks split one large deployment into smaller, reusable pieces within a single account and Region. StackSets take one deployment and replicate it across many accounts and Regions. Reaching for one when you need the other is a common early mistake.

Frequently asked questions

What is the difference between a CloudFormation stack and a template?

A template is the text file describing what you want built — the recipe. A stack is the actual deployed result once CloudFormation reads that template and provisions real resources — the finished meal. The template is inert on your laptop; the stack is live in your AWS account and billing you the entire time it exists.

Can one template create more than one stack?

Yes, and it's one of the more useful patterns once you notice it. You can deploy the identical template multiple times with different stack names and different parameter values — a common setup is a "dev" stack and a "prod" stack built from the exact same file, just with a smaller instance size and different environment tag on the dev side.

What happens to my resources if I delete a CloudFormation stack?

Every resource in the stack is deleted, unless you set that specific resource's DeletionPolicy to Retain or Snapshot in the template beforehand. There is no separate confirmation per resource — deleting the stack deletes everything with the default policy, all at once.

Does deleting a stack delete my S3 bucket's data too?

If the bucket's DeletionPolicy is left at the default, CloudFormation will attempt to delete the bucket along with the stack, and a non-empty bucket generally causes that specific deletion to fail, leaving the whole stack sitting in DELETE_FAILED rather than quietly succeeding around it. Set DeletionPolicy: Retain on any bucket you don't want touched, before you ever need to delete the stack.

Why is my stack stuck in UPDATE_ROLLBACK_FAILED?

The rollback itself failed, usually because one resource couldn't be reverted back to its previous configuration for some reason — a permissions issue, a manual change made outside CloudFormation, a service-side limit. Find and fix that specific resource (through its own console or by adjusting permissions), then use ContinueUpdateRollback to finish the rollback and return the stack to UPDATE_ROLLBACK_COMPLETE.

What does ROLLBACK_COMPLETE mean and why can't I update it?

ROLLBACK_COMPLETE only happens after a stack's original creation failed and was cleaned up. Because the stack never actually finished being created, there's no working version to fall back to or update toward — CloudFormation only allows a delete from this status. The path forward is to delete it and create a fresh stack once you've fixed whatever the template was doing wrong the first time.

How many resources can I put in a single stack?

500 resources per stack under current CloudFormation quotas — up from the older limit of 200. Nested stacks raise the practical ceiling for a whole application, with a separate limit of 2,500 resources per nested-stack operation.

What's the difference between a nested stack and a StackSet?

A nested stack splits one large template into smaller, reusable pieces within a single account and Region, tightly tied to a parent stack. A StackSet deploys the same template as separate, independent stacks across many different accounts and Regions from one operation. One is about tidying up a big deployment; the other is about repeating a deployment everywhere.

Does AWS charge extra for using CloudFormation?

No, CloudFormation itself doesn't carry a separate service fee. You're billed for the underlying resources the stack creates, exactly as you would be if you created them one at a time by hand in each service's own console.

Can I rename a CloudFormation stack after creating it?

No, a stack's name is set when it's created and can't be changed afterward through a normal update. Renaming effectively means creating a new stack with the desired name and migrating or recreating the resources into it, or using stack refactoring to move resources between stacks without recreating them from scratch.

What is stack drift and why does it matter?

Drift is when a resource's real, live configuration no longer matches what the stack's template says it should be — usually because someone changed it manually outside CloudFormation. It matters because a subsequent stack update might unexpectedly revert that manual change back to the template's version, surprising anyone unaware the drift existed in the first place.

Should I use change sets or direct updates?

Use change sets whenever you're not completely certain what an update will do — especially before touching anything with real data, like a database. Direct updates are fine for small, well-understood changes you've made many times before, where you already know exactly what CloudFormation is going to do.

Can two stacks share resources?

A resource is only ever managed by one stack at a time, but stacks can share values between each other using cross-stack references — one stack exports an output (like a VPC ID), and another stack imports it, without either stack owning or duplicating the underlying resource itself.

What happens if I edit a resource manually that CloudFormation created?

The resource keeps working, but it's now out of sync with the stack's template — that's drift. It won't break anything immediately, but the next stack update may overwrite your manual change without warning, which is exactly why running drift detection before a big update is worth the extra minute.

How do I stop someone from accidentally deleting a production stack?

Enable termination protection on the stack itself, attach a stack policy to protect specific critical resources during updates, and set DeletionPolicy: Retain or Snapshot on anything genuinely irreplaceable. Each protects against a different failure mode, so use all three together rather than picking just one.

What is the difference between a root stack and a parent stack in nested stacks?

The root stack is the single top-level stack that every nested stack in the hierarchy ultimately belongs to. A parent stack is whichever stack directly created a given nested stack — for the first level of nesting these are the same stack, but for deeper nested layers, the parent is itself a nested stack, not the root.

Revision note. Written September 2026. This will need a refresh if AWS changes the resource-per-stack quota again, reworks the rollback commands further, or expands express mode's default behavior. If you're staring at a stuck stack right now at the end of a long day, take a breath — almost every status on that table above has a documented way out, and you are not the first person this has happened to.

Related