In CloudFormation both nested stacks and modules encourage reusability by creating common components.
From the AWS documentation it is not coming out when to use what. Any suggestions?
In CloudFormation both nested stacks and modules encourage reusability by creating common components.
From the AWS documentation it is not coming out when to use what. Any suggestions?
Here is good experimentation with the following conclusions:
CloudFormation Modules are a good evolution of the nested stacks concept that arguably should have arrived a few years ago. And unfortunately, in their current state, they aren’t suitable for use in an enterprise—or any—environment.
So I think its better to stick with nested stacks, unless you have specific requirements to use modules.
The fundamental difference is that with a module you deploy a single stack for your productive resources whereas nested stack deploy 1 or many stacks at once, as the term "nested" suggests. I say "productive resources" to refer to the resources you actually want to deploy, excluding the overhead that comes with modules and nested stacks respectively.
The one thing modules and nested stacks have in common is that in both cases the underlying basic unit is just a regular stack.
Some key differences are:
MyOrganization::MyNamespace::MyApp::MODULE
. A nested stack is created via resource type AWS::CloudFormation::Stack
.TemplateURL
).The official docs of AWS for CFN modules are quite sparse. The most comprehensible explanation of modules I found is this AWS blog post.