OK, so let's have a look at how we can create Auto Scaling groups using cloud formation, because this
is something you need to know.
So let's go in to create Stack and then we'll choose a template file.
And that template file will be the one you get from the code in there.
Just killing and confirmation.
And we'll start with zero creation policy for ASG.
So let's go quickly see what this does in my code editor.
So in this template, I have a Parmeter and it's using the SSN public private store to get the MAIG
for the latest Amazonian x2.
Then we create an auto selling group and for the azy it's getting them from the region, name it and
ready for the launch configuration.
It's a reference to the launch configuration I defined below.
The desired capacity is going to be three instances, the midsize going to be one and the max size is
going to be four.
But how do we know if this latest killing group is correctly being launched?
We want to make sure that the instances are able to signal the fact that they have launched correctly
so that we know that this creation of the auto scanning group itself has worked as well.
So we can atch we can attach a creation policy to your auto scanning group so that we are waiting for
resources to signal and we are waiting for three resources to signal a correct number.
So this is the same as my desired capacity, obviously.
And we're saying we are willing to accept fifteen minutes of wait before these instances come up.
And if that timeout happens, then the whole auto scaling group will fail to launch.
So this is really good because if you have a very complicated launch configuration with a lot of easy
to use the data in it and something fails within your easy to use of data, you want to make sure that
this does kind of group does receive a failed signal.
And if it does, then this entire thing will just roll back and stop working.
So if we scroll down and look at the launch configuration, it is very simple for the image idea.
The mice using the latest Linux MAIG that I get from the parameters and then I will scroll down.
The instant types of T2 Micro and the user data is very simple.
It's the base 64 of this entire script file.
And which does something very simple.
It gets the bootstrap scripts and then it uses this Yifan signal script to say to my stack my stock
name for the resource auto scanning group, which is defined right here for the resource just going
group and the region.
You're in signal the fact that you are successful.
And so this launch configured that showed this.
What does can group on the three instances we have will do.
Three signals onto the Atlas killing group and hopefully will work.
So let's go back into cloud formation.
We're going to click on next call it Demo ASG, TFN and click on next.
I'll scroll down, click on next and create my stuck in the very bottom.
Here we go.
And now my creation is in progress.
And as we can see here, the second group is being created.
And if you go to my oldest gang group, you.
It has been created.
But this Yifan stack itself is not in create complete states because we are waiting for three signals
to come from these three.
You see two instances that are being created for me.
So we need to wait for these three instances to use the use of that script and then signal back into
cloud formation their success.
And when they do signal their success, how it is, then we will go into create completes.
And so you can see here that there's three events that happened in this timeline and the event says
receives a success signal with a unique iji.
I love Allai, which is the instance idee here.
So we have three different different instance I.D. And so the three instances here, here and here have
signaled their success to cloud watch, to call the formation.
Sorry.
And so as cloud formation has had the success and it was waiting for three success counts as part of
the creation policy, then what we get out of it is a create completes for this ASG.
So remember going into the exam, okay, if you want to make sure that the instances are properly configured
when being created for the first creation of it NASD, then you make sure to set and creation policy
for your as yourself.
Okay, well that's it for this lecture.
In the next lecture we'll look at updates policy.