‫So now let's talk about
‫a few advanced concepts for CloudFormation.
‫We will not do hands-on on them, but some of them
‫we've already seen and some of them
‫we'll just see in slides.
‫So the first one is ChangeSets,
‫and we've seen that already.
‫When we update a stack, we need to know in advance
‫what changes will happen before it happens
‫for a greater confidence,
‫and so ChangeSets won't say if the update
‫is successful or not, as we've seen from before,
‫but it will tell us what will happen.
‫So, we have the original stack.
‫We create a ChangeSet by uploading a new stack,
‫and this is something we've seen in the hands-on.
‫Then we can view this ChangeSet and we'll feel happy.
‫We can optionally change to, change our ChangeSet
‫by uploading a new stack to modify it,
‫and once we are happy, we can execute the ChangeSet,
‫and it will be applied
‫to the current CloudFormation template.
‫So this is all the steps we've been already doing
‫through the hands-on when we updated a CloudFormation stack.
‫Okay, next is a concept of nested stacks.
‫So nested stacks are CloudFormation stacks
‫part of other stacks.
‫They allow you to update and to isolate repeated patterns,
‫common components in your separate stack,
‫and call them from other stacks.
‫So, I'll give you an example.
‫A Load Balancer configuration that is re-used, for example,
‫or a Security Group configuration that is re-used,
‫and so nested stacks are considered best practices
‫and to update a nested stack, the first thing to do
‫is to update the parent.
‫So, now you may be asking me,
‫what is the difference between
‫a cross stack and a nested stack?
‫So a cross stack is helpful when stacks
‫have different life cycles.
‫For example, we want to have a VPC stack and another stack
‫that references it, and they both have
‫different life cycles.
‫So in this case, we use Output Exports and the FnImportValue
‫for the interesting function,
‫and then this is when you need
‫to pass export values to many stacks.
‫So in this example, the VPC stack is gonna be reused
‫across many different stacks, and the values needs to be
‫exported and imported, so that makes a lot of sense.
‫But nested stack, this is helpful when components
‫must be reused and recreated.
‫For example, say we want to properly configure
‫an Application Load Balancer,
‫we could isolate it as a nested stack.
‫And so this is only important when the nested stack
‫is just mattering for the higher-level stack.
‫It's not shared across stacks.
‫So the second example, we have an application stack.
‫We have an RDS nested stack, an ASG nested stack,
‫and the ELB nested stack, and we create
‫a second application stack
‫again that will have all the other's nested stacks.
‫So hopefully through these diagrams, it is very clear
‫what is the difference between
‫a cross stack and a nested stacks.
‫This is very hard to say, I'm sorry.
‫Finally, there is StackSets, which is to create, update,
‫or delete stack across multiple accounts and regions
‫with a single operation, so this is gonna apply a stack
‫all around different accounts and different regions.
‫Administrator's accounts can create StackSets,
‫and then the trusted accounts can create, update,
‫or delete stack instances from the Stacksets.
‫And so the cool thing about StackSets is that
‫if you update a StackSet, all the associated stack instances
‫in all the regions and all the other accounts
‫will be updated as well.
‫So the idea is that in the administrator accounts,
‫you create the StackSets, and it gets applied
‫to account A, region one, account A, region two,
‫and account B, region three.
‫And that's the beautiful thing about Stacksets,
‫so any time you see in the exam anything about
‫updating a CloudFormation stack into multiple accounts
‫and multiple region, think StackSets.
‫So that's it for this very short theory lecture.
‫I hope that was helpful,
‫and I will see you in the next lecture.