Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Cloudformation - Stack vs NestedStack

I thought that this would be answered quite clearly out there on the internet. But I have found no sufficient answer to when to use one type of stacks and when to use another type of stacks.

  • So the main question is what is the difference between regular stacks and nested stacks?

I can perfectly model my infrastructure using only regular stacks. Also, I can perfectly model my infrastructure using only nested stacks and one root regular stack. From a project perspective - the only difference is stack type names. Everything else is the same.

For example, I am using AWS CDK - a synthesizer that can, for example, synthesize python to CloudFormation templates. I can do everything using Stacks and I can simply find-and-replace Stack to NestedStack. The infrastructure would be redeployed but nothing essentially has changed.

  • So why would I use nested stack over a regular stack? What are their own advantages?
like image 402
Laimonas Sutkus Avatar asked Apr 22 '26 06:04

Laimonas Sutkus


1 Answers

The biggest "difference" with nested stacks is that they become part of the parent stack. This means that if anything fails to deploy all stacks (parent and nested) get rolled back as one. By contrast with multiple stacks you could have the first one succeed to deploy, the second fail and roll back and the third not even attempt a deployment.

like image 166
Alex Avatar answered Apr 24 '26 23:04

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!