> For the complete documentation index, see [llms.txt](https://ysfang82.gitbook.io/development-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ysfang82.gitbook.io/development-notes/aws-notes/lab/adding-auto-scaling.md).

# Auto-scaling Implementation

**Purpose**

* Adding an auto-scaling Mechanism for a web server&#x20;

**Steps**

1. **Create an ELB (**[**how to**](https://ysfang82.gitbooks.io/development-notes/content/implementing-elb.html)), but no need to register instances as balancing targets at this moment.
2. **Launch Configuration**
   * On EC2 Dashboard page -> left side "AUTO SCALING" -> "Launch Configurations" -> "Create launch configuration". (Most of the steps are similar to creating EC2.)
   * On "Configure details" page:
     * Give configuration name
     * Grant IAM Role with privileges if needed. (In this example it's "AmazonS3FullAccess".)
     * Create a web server. (Refer to 3.(3) of this [article](https://ysfang82.gitbooks.io/development-notes/content/running-ec2.html))
   * Following constructions to complete settings and click "Create Launch Configuration".
3. **Create Auto Scaling Group**
   * On EC2 Dashboard page -> left side "AUTO SCALING" -> "Auto Scaling Group" -> "Create Auto Scaling Group":
     * Give a group name
     * Add subnet items (each subnet maps to an AZ).
     * "Advanced Details":
       * Tick "Receive traffic from one or more load balancers", and select target groups created in step 1.
       * Set "Health Check Grace Period" seconds with appropriate time for instances to initialize.
   * On "Configure scaling policies" page, choose to keep a fixed number of instances or criteria to increase / decrease group size.
   * On "Configure Notifications" page, set up notification criteria.
   * Follow instructions to complete auto scaling group setting, and go back to EC2 dashboard or browse to ELB DNS name to see the result.
