> For the complete documentation index, see [llms.txt](https://dev7days.gitbook.io/dev7days/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev7days.gitbook.io/dev7days/aws/elb-and-asg/asg.md).

# ASG

Describe about What is ASG ?

ASG or Auto scaling group it is a service of AWS that use to scale out/in for `EC2` instance. ASG are free but you need to pay for the new instances that running. You need to specify&#x20;

* (1) Minimum capacity (Numbers of minimum instance)&#x20;
* (2) Desired Capacity (Numbers of current running instance)&#x20;
* (3) Maximum capacity (Numbers of maximum instance)<br>

### Scaling Policies

#### (1) Dynamic Scaling

* Target Tracking Scaling = It is most simple way you can set up in ASG byyourself \
  example: I want the average ASG CPU to stay around 40 % if not it will scale out.
* Simple/Step Scaling = It use AWS Cloud watch alarm to trigger ASG.\
  example: When CPU > 70% then add 2 units.
* Scheduled Actions = It is a pattern that we can customize for trigger.\
  example: increase the min capacity to 10 at 5 pm on Fridays.&#x20;

#### (2) Predictive Scaling

It will forecast load and you can set the rule to scale it.<br>

{% hint style="warning" %}
After a scaling activity happen, ASG will cooldown (default 300 sec). During this time ASG will not launch or terminate additional instance.\
\
Advice: Use AMI to reduce configuration time in order to be serving request fasters and reduce the cooldown period.
{% endhint %}
