

# Get started with Amazon EC2 Auto Scaling
<a name="get-started-with-ec2-auto-scaling"></a>

To get started with Amazon EC2 Auto Scaling, you can follow tutorials that introduce you to the service.

**Topics**
+ [

# Tutorial: Create your first Auto Scaling group
](create-your-first-auto-scaling-group.md)
+ [

# Tutorial: Set up a scaled and load-balanced application
](tutorial-ec2-auto-scaling-load-balancer.md)

For additional tutorials that focus on specific tools for managing the lifecycle of instances in an Auto Scaling group, see the following topics:
+ [Tutorial: Configure a lifecycle hook that invokes a Lambda function](tutorial-lifecycle-hook-lambda.md). This tutorial shows you how to use Amazon EventBridge to create rules that invoke Lambda functions based on events that happen to the instances in your Auto Scaling group.
+ [Tutorial: Use data script and instance metadata to retrieve lifecycle state](tutorial-lifecycle-hook-instance-metadata.md). This tutorial shows you how to use the Instance Metadata Service (IMDS) to invoke an action from within the instance itself.

Before you create an Auto Scaling group for use with your application, review your application thoroughly as it runs in the AWS Cloud. Consider the following: 
+ How many Availability Zones the Auto Scaling group should span.
+ What existing resources can be used, such as security groups or Amazon Machine Images (AMIs).
+ Whether you want to scale to increase or decrease capacity, or if you just want to ensure that a specific number of servers are always running. Keep in mind that Amazon EC2 Auto Scaling can do both simultaneously.
+ What metrics have the most relevance to your application's performance.
+ How long it takes to launch and provision a server.

The better you understand your application, the more effective you can make your Auto Scaling architecture.

# Tutorial: Create your first Auto Scaling group
<a name="create-your-first-auto-scaling-group"></a>

This tutorial provides a hands-on introduction to Amazon EC2 Auto Scaling through the AWS Management Console. You'll create a launch template that defines your EC2 instances and an Auto Scaling group with a single instance in it. After launching your Auto Scaling group, you'll terminate the instance and verify that the instance was removed from service and replaced. To maintain a constant number of instances, Amazon EC2 Auto Scaling detects and responds to Amazon EC2 health and reachability checks automatically.

When you sign up for AWS, you can get started with Amazon EC2 Auto Scaling for free using the [AWS Free Tier](https://aws.amazon.com/free/). You can use the free tier to launch and use a `t2.micro` instance for free for 12 months (in Regions where `t2.micro` is unavailable, you can use a `t3.micro` instance under the free tier). If you launch an instance that is not within the free tier, you incur the standard Amazon EC2 usage fees for the instance. For more information, see [Amazon EC2 pricing](https://aws.amazon.com/ec2/pricing/).

**Topics**
+ [

## Prepare for the walkthrough
](#gs-preparing-for-walkthrough)
+ [

## Step 1: Create a launch template
](#gs-create-lt)
+ [

## Step 2: Create a single-instance Auto Scaling group
](#gs-create-asg)
+ [

## Step 3: Verify your Auto Scaling group
](#gs-verify-asg)
+ [

## Step 4: Terminate an instance in your Auto Scaling group
](#gs-asg-terminate-instance)
+ [

## Step 5: Next steps
](#gs-tutorial-next-steps)
+ [

## Step 6: Clean up
](#gs-delete-asg)

## Prepare for the walkthrough
<a name="gs-preparing-for-walkthrough"></a>

This walkthrough assumes that you are familiar with launching EC2 instances and that you have already created a key pair and a security group.

To get started using Amazon EC2 Auto Scaling, you can use the *default* VPC for your AWS account. The default VPC includes a default public subnet in each Availability Zone and an internet gateway that is attached to your VPC. You can view your VPCs on the [Your VPCs page](https://console.aws.amazon.com/vpc/home?/#vpcs) of the Amazon Virtual Private Cloud (Amazon VPC) console.

## Step 1: Create a launch template
<a name="gs-create-lt"></a>

In this step, you create a launch template that specifies the type of EC2 instance that Amazon EC2 Auto Scaling creates for you. Include information such as the ID of the Amazon Machine Image (AMI) to use, the instance type, the key pair, and security groups.

**To create a launch template**

1. Open the Amazon EC2 console and go to the [Launch templates page](https://console.aws.amazon.com/ec2/v2/#LaunchTemplates).

1. On the top navigation bar, select an AWS Region. The launch template and Auto Scaling group that you create are tied to the Region that you specify. 

1. Choose **Create launch template**.

1. For **Launch template name**, enter **my-template-for-auto-scaling**.

1. Under **Auto Scaling guidance**, select the check box. 

1. For **Application and OS Images (Amazon Machine Image)**, choose a version of Amazon Linux 2 (HVM) from the **Quick Start** list. The AMI serves as a basic configuration template for your instances. 

1. For **Instance type**, choose a hardware configuration that is compatible with the AMI that you specified.

1. (Optional) For **Key pair (login)**, choose an existing key pair. You use key pairs to connect to an Amazon EC2 instance with SSH. Connecting to an instance is not included as part of this tutorial. Therefore, you don't need to specify a key pair unless you intend to connect to your instance using SSH. 

1. For **Network settings**, expand **Advanced network configuration** and do the following:

   1. Choose **Add network interface** to configure the primary network interface.

   1. For **Auto-assign public IP**, specify whether your instance receives a public IPv4 address. By default, Amazon EC2 assigns a public IPv4 address if the EC2 instance is launched into a default subnet or if the instance is launched into a subnet that's been configured to automatically assign a public IPv4 address. If you don't need to connect to your instance, choose **Disable**.

   1. For **Security group ID**, choose a security group in the same VPC that you plan to use as the VPC for your Auto Scaling group. If you don't specify a security group, your instance is automatically associated with the default security group for the VPC.

   1. For **Delete on termination**, choose **Yes** to delete the network interface when the instance is deleted.

1. Choose **Create launch template**.

1. On the confirmation page, choose **Create Auto Scaling group**.

## Step 2: Create a single-instance Auto Scaling group
<a name="gs-create-asg"></a>

Use the following procedure to continue where you left off after creating a launch template. 

**To create an Auto Scaling group**

1. On the **Choose launch template or configuration** page, for **Auto Scaling group name**, enter **my-first-asg**.

1. Choose **Next**. 

   The **Choose instance launch options** page appears, allowing you to choose the VPC network settings you want the Auto Scaling group to use and giving you options for launching On-Demand and Spot Instances. 

1. In the **Network** section, keep **VPC** set to the default VPC for your chosen AWS Region, or select your own VPC. The default VPC is automatically configured to provide internet connectivity to your instance. This VPC includes a public subnet in each Availability Zone in the Region. 

1. For **Availability Zones and subnets**, choose a subnet from each Availability Zone that you want to include. Use subnets in multiple Availability Zones for high availability. For more information, see [Considerations when choosing VPC subnets](asg-in-vpc.md#as-vpc-considerations).

1. In the **Instance type requirements** section, use the default setting to simplify this step. (Do not override the launch template.) For this tutorial, you will launch only one On-Demand Instance using the instance type specified in your launch template.

1. Keep the rest of the defaults for this tutorial and choose **Skip to review**. 
**Note**  
The initial size of the group is determined by its desired capacity. The default value is `1` instance. 

1. On the **Review** page, review the information for the group, and then choose **Create Auto Scaling group**.

## Step 3: Verify your Auto Scaling group
<a name="gs-verify-asg"></a>

Now that you have created an Auto Scaling group, you are ready to verify that the group has launched an EC2 instance.

**Tip**  
In the following procedure, you look at the **Activity history** and **Instances** sections for the Auto Scaling group. In both, the named columns should already be displayed. To display hidden columns or change the number of rows shown, choose the gear icon on the top right corner of each section to open the preferences modal, update the settings as needed, and choose **Confirm**.

**To verify that your Auto Scaling group has launched an EC2 instance**

1. Open the [Auto Scaling groups page](https://console.aws.amazon.com/ec2/v2/home?#AutoScalingGroups) of the Amazon EC2 console.

1. Select the check box next to the Auto Scaling group that you just created. 

   A split pane opens up in the bottom of the **Auto Scaling groups** page. The first tab available is the **Details** tab, showing information about the Auto Scaling group.

1. Choose the second tab, **Activity**. Under **Activity history**, you can view the progress of activities that are associated with the Auto Scaling group. The **Status** column shows the current status of your instance. While your instance is launching, the status column shows `Not yet in service`. The status changes to `Successful` after the instance is launched. You can also use the refresh button to see the current status of your instance.

1. On the **Instance management** tab, under **Instances**, you can view the status of the instance.

1. Verify that your instance launched successfully. It takes a short time for an instance to launch. 
   + The **Lifecycle** column shows the state of your instance. Initially, your instance is in the `Pending` state. After an instance is ready to receive traffic, its state is `InService`.
   + The **Health status** column shows the result of the Amazon EC2 Auto Scaling health checks on your instance.

## Step 4: Terminate an instance in your Auto Scaling group
<a name="gs-asg-terminate-instance"></a>

Use these steps to learn more about how Amazon EC2 Auto Scaling works, specifically, how it launches new instances when necessary. The minimum size for the Auto Scaling group that you created in this tutorial is one instance. Therefore, if you terminate that running instance, Amazon EC2 Auto Scaling must launch a new instance to replace it.

1. Open the [Auto Scaling groups page](https://console.aws.amazon.com/ec2/v2/home?#AutoScalingGroups) of the Amazon EC2 console.

1. Select the check box next to your Auto Scaling group. 

1. On the **Instance management** tab, under **Instances**, select the ID of the instance.

   This takes you to the **Instances** page of the Amazon EC2 console, where you can terminate the instance.

1. Choose **Actions**, **Instance State**, **Terminate**. When prompted for confirmation, choose **Yes, Terminate**.

1. On the navigation pane, under **Auto Scaling**, choose **Auto Scaling Groups**. Select your Auto Scaling group and choose the **Activity** tab.

   When you terminate an instance from the **Instances** page, it takes a minute or two after you terminate the instance before a new instance launches. In the activity history, when the scaling activity starts, you see an entry for the termination of the first instance and an entry for the launch of a new instance. Use the refresh button until you see the new entries.

1. On the **Instance management** tab, the **Instances** section shows the new instance only. 

1. On the navigation pane, under **Instances**, choose **Instances**. This page shows both the terminated instance and the new running instance.

## Step 5: Next steps
<a name="gs-tutorial-next-steps"></a>

Go to the next step if you would like to delete the basic infrastructure that you just created. Otherwise, you can use this infrastructure as your base and try one or more of the following:
+ Connect to your Linux instance using Session Manager or SSH. For more information, see [Connect to your EC2 instance using Session Manager](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-with-systems-manager-session-manager.html) and [Connect to your Linux instance using SSH](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-to-linux-instance.html) in the *Amazon EC2 User Guide*.
+ Configure an Amazon SNS notification to notify you whenever your Auto Scaling group launches or terminates instances. For more information, see [Amazon SNS notification options](ec2-auto-scaling-sns-notifications.md).
+ Manually scale your Auto Scaling group to test the SNS notification. For more information, see [Change the desired capacity of your Auto Scaling group](ec2-auto-scaling-scaling-manually.md#change-desired-capacity).

You can also start familiarizing yourself with auto scaling concepts by reading about [Target tracking scaling policies](as-scaling-target-tracking.md). If the load on your application changes, your Auto Scaling group can scale out (add instances) and scale in (run fewer instances) automatically by adjusting the desired capacity of the group between the minimum and maximum capacity limits. For more information about setting these limits, see [Set scaling limits for your Auto Scaling group](asg-capacity-limits.md).

## Step 6: Clean up
<a name="gs-delete-asg"></a>

You can either delete your scaling infrastructure or delete just your Auto Scaling group and keep your launch template to use later.

If you launched an instance that is not within the [AWS Free Tier](https://aws.amazon.com/free/), you should terminate your instance to prevent additional charges. When you terminate the instance, the data associated with it will also be deleted.

**To delete your Auto Scaling group**

1. Open the [Auto Scaling groups page](https://console.aws.amazon.com/ec2/v2/home?#AutoScalingGroups) of the Amazon EC2 console.

1. Select the check box next to your Auto Scaling group (`my-first-asg`).

1. Choose **Delete**. 

1. When prompted for confirmation, type **delete** to confirm deleting the specified Auto Scaling group and then choose **Delete**.

   A loading icon in the **Name** column indicates that the Auto Scaling group is being deleted. When the deletion has occurred, the **Desired**, **Min**, and **Max** columns show `0` instances for the Auto Scaling group. It takes a few minutes to terminate the instance and delete the group. Refresh the list to see the current state. 

Skip the following procedure if you would like to keep your launch template.

**To delete your launch template**

1. Open the [Launch templates page](https://console.aws.amazon.com/ec2/v2/#LaunchTemplates) of the Amazon EC2 console.

1. Select your launch template (`my-template-for-auto-scaling`).

1. Choose **Actions**, **Delete template**.

1. When prompted for confirmation, type **Delete** to confirm deleting the specified launch template and then choose **Delete**.

# Tutorial: Set up a scaled and load-balanced application
<a name="tutorial-ec2-auto-scaling-load-balancer"></a>

**Important**  
Before you explore this tutorial, we recommend that you first review the following introductory tutorial: [Create your first Auto Scaling group](create-your-first-auto-scaling-group.md).

Registering your Auto Scaling group with an Elastic Load Balancing load balancer helps you set up a load-balanced application. Elastic Load Balancing works with Amazon EC2 Auto Scaling to distribute incoming traffic across your healthy Amazon EC2 instances. This increases the scalability and availability of your application. You can enable Elastic Load Balancing within multiple Availability Zones to increase the fault tolerance of your applications. 

In this tutorial, we cover the basics steps for setting up a load-balanced application when the Auto Scaling group is created. When complete, your architecture should look similar to the following diagram:

![\[An Auto Scaling group with an Application Load Balancer.\]](http://docs.aws.amazon.com/autoscaling/ec2/userguide/images/elb-tutorial-architecture-diagram.png)


Elastic Load Balancing supports different types of load balancers. We recommend that you use an Application Load Balancer for this tutorial. 

For more information about introducing a load balancer into your architecture, see [Use Elastic Load Balancing to distribute incoming application traffic in your Auto Scaling group](autoscaling-load-balancer.md).

**Topics**
+ [

## Prerequisites
](#as-register-lbs-prerequisites)
+ [

## Step 1: Set up a launch template or launch configuration
](#as-register-lbs-create-lt-console)
+ [

## Step 2: Create an Auto Scaling group
](#as-register-lbs-create-asg-console)
+ [

## Step 3: Verify that your load balancer is attached
](#as-register-lbs-verify-console)
+ [

## Step 4: Next steps
](#as-lbs-app-next-steps)
+ [

## Step 5: Clean up
](#as-lbs-app-clean-up)
+ [

## Related resources
](#tutorial-ec2-auto-scaling-load-balancer-related-resources)

## Prerequisites
<a name="as-register-lbs-prerequisites"></a>
+ A load balancer and target group. Make sure to choose the same Availability Zones for the load balancer that you plan to use for your Auto Scaling group. For more information, see [Getting started with Elastic Load Balancing](https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/load-balancer-getting-started.html) in the *Elastic Load Balancing User Guide*.
+ A security group for your launch template or launch configuration. The security group must allow access from the load balancer on both the listener port (usually port 80 for HTTP traffic) and the port that you want Elastic Load Balancing to use for health checks. For more information, see the applicable documentation:
  + [Target security groups](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-register-targets.html#target-security-groups) in the *User Guide for Application Load Balancers*
  + [Target security groups](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-register-targets.html#target-security-groups) in the *User Guide for Network Load Balancers*

  Optionally, if your instances will have public IP addresses, you can allow SSH traffic for connecting to the instances. 
+ (Optional) An IAM role that grants your application access to AWS.
+ (Optional) An Amazon Machine Image (AMI) defined as the source template for your Amazon EC2 instances. To create one now, launch an instance. Specify the IAM role (if you created one) and any configuration scripts that you need as user data. Connect to the instance and customize it. For example, you can install software and applications, copy data, and attach additional EBS volumes. Test your applications on your instance to ensure that it is configured correctly. Save this updated configuration as a custom AMI. If you don't need the instance later, you can terminate it. Instances launched from this new custom AMI include the customizations that you made when you created the AMI. 
+ A virtual private cloud (VPC). This tutorial refers to the default VPC, but you can use your own. If using your own VPC, make sure that it has a subnet mapped to each Availability Zone of the Region you are working in. At minimum, you must have two public subnets available to create the load balancer. You must also have either two private subnets or two public subnets to create your Auto Scaling group and register it with the load balancer.

## Step 1: Set up a launch template or launch configuration
<a name="as-register-lbs-create-lt-console"></a>

Use either a launch template or a launch configuration for this tutorial. 

**Topics**
+ [

### Select or create a launch template
](#as-register-lbs-create-lt-console)
+ [

### Select or create a launch configuration
](#as-register-lbs-create-lc-console)

### Select or create a launch template
<a name="as-register-lbs-create-lt-console"></a>

If you already have a launch template that you'd like to use, select it by using the following procedure. 

**To select an existing launch template**

1. Open the [Launch templates page](https://console.aws.amazon.com/ec2/v2/#LaunchTemplates) of the Amazon EC2 console.

1. On the navigation bar at the top of the screen, choose the Region where the load balancer was created.

1. Select a launch template.

1. Choose **Actions**, **Create Auto Scaling group**.

Alternatively, to create a new launch template, use the following procedure.

**To create a launch template**

1. Open the [Launch templates page](https://console.aws.amazon.com/ec2/v2/#LaunchTemplates) of the Amazon EC2 console.

1. On the navigation bar at the top of the screen, choose the Region where the load balancer was created.

1. Choose **Create launch template**. 

1. Enter a name and provide a description for the initial version of the launch template.

1. For **Application and OS Images (Amazon Machine Image)**, choose the ID of the AMI for your instances. You can search through all available AMIs, or select an AMI from the **Recents** or **Quick Start** list. If you don't see the AMI that you need, choose **Browse more AMIs** to browse the full AMI catalog.

1. For **Instance type**, select a hardware configuration for your instances that is compatible with the AMI that you specified.

1. (Optional) For **Key pair (login)**, choose the key pair to use when connecting to your instances.

1. For **Network settings**, expand **Advanced network configuration** and do the following:

   1. Choose **Add network interface** to configure the primary network interface.

   1. For **Auto-assign public IP**, specify whether your instances receive public IPv4 addresses. By default, Amazon EC2 assigns a public IPv4 address if the EC2 instance is launched into a default subnet or if the instance is launched into a subnet that's been configured to automatically assign a public IPv4 address. If you don't need to connect to your instances, you can choose **Disable** to prevent instances in your group from receiving traffic directly from the internet. In this case, they will receive traffic only from the load balancer.

   1. For **Security group ID**, specify a security group for your instances from the same VPC as the load balancer. 

   1. For **Delete on termination**, choose **Yes**. This deletes the network interface when the Auto Scaling group scales in, and terminates the instance to which the network interface is attached. 

1. (Optional) To securely distribute credentials to your instances, for **Advanced details**, **IAM instance profile**, enter the Amazon Resource Name (ARN) of your IAM role.

1. (Optional) To specify user data or a configuration script for your instances, paste it into **Advanced details**, **User data**.

1. Choose **Create launch template**. 

1. On the confirmation page, choose **Create Auto Scaling group**.

### Select or create a launch configuration
<a name="as-register-lbs-create-lc-console"></a>

**Note**  
We strongly discourage using launch configurations in new applications because it is a legacy feature with no planned investment. In addition, new accounts created on or after June 1, 2023 will not have the option to create new launch configurations through the console. For more information, see [Auto Scaling launch configurations](launch-configurations.md).

**To select an existing launch configuration**

1. Open the [Launch configurations page](https://console.aws.amazon.com/ec2/v2/home?#LaunchConfigurations) of the Amazon EC2 console.

1. On the top navigation bar, choose the Region where the load balancer was created.

1. Select a launch configuration.

1. Choose **Actions**, **Create Auto Scaling group**.

Alternatively, to create a new launch configuration, use the following procedure.

**To create a launch configuration**

1. Open the [Launch configurations page](https://console.aws.amazon.com/ec2/v2/home?#LaunchConfigurations) of the Amazon EC2 console. When prompted for confirmation, choose **View launch configurations** to confirm that you want to view the **Launch configurations** page. 

1. On the top navigation bar, choose the Region where the load balancer was created.

1. Choose **Create launch configuration**, and enter a name for your launch configuration. 

1. For **Amazon machine image (AMI)**, enter the ID of the AMI for your instances as search criteria. 

1. For **Instance type**, select a hardware configuration for your instance.

1. Under **Additional configuration**, pay attention to the following fields:

   1. (Optional) To securely distribute credentials to your EC2 instance, for **IAM instance profile**, select your IAM role. For more information, see [IAM role for applications that run on Amazon EC2 instances](us-iam-role.md).

   1. (Optional) To specify user data or a configuration script for your instance, paste it into **Advanced details**, **User data**.

   1. (Optional) For **Advanced details**, **IP address type**, keep the default value. When you create your Auto Scaling group, you can assign a public IP address to instances in your Auto Scaling group by using subnets that have the public IP addressing attribute enabled, such as the default subnets in the default VPC. Alternatively, if you don't need to connect to your instances, you can choose **Do not assign a public IP address to any instances** to prevent instances in your group from receiving traffic directly from the internet. In this case, they will receive traffic only from the load balancer.

1. For **Security groups**, choose an existing security group from the same VPC as the load balancer. If you keep the **Create a new security group** option selected, a default SSH rule is configured for Amazon EC2 instances running Linux. A default RDP rule is configured for Amazon EC2 instances running Windows. 

1. For **Key pair (login)**, choose an option under **Key pair options**. 

   If you've already configured an Amazon EC2 instance key pair, you can choose it here. 

   If you don't already have an Amazon EC2 instance key pair, choose **Create a new key pair** and give it a recognizable name. Choose **Download key pair** to download the key pair to your computer. 
**Important**  
If you need to connect to your instances, do not choose **Proceed without a key pair**.

1. Select the acknowledgment check box, and then choose **Create launch configuration**.

1. Select the check box next to the name of your new launch configuration and choose **Actions**, **Create Auto Scaling group**. 

## Step 2: Create an Auto Scaling group
<a name="as-register-lbs-create-asg-console"></a>

Use the following procedure to continue where you left off after creating or selecting your launch template or launch configuration. 

**To create an Auto Scaling group**

1. On the **Choose launch template or configuration** page, for **Auto Scaling group name**, enter a name for your Auto Scaling group.

1. [Launch template only] For **Launch template**, choose whether the Auto Scaling group uses the default, the latest, or a specific version of the launch template when scaling out.

1. Choose **Next**. 

   The **Choose instance launch options** page appears, allowing you to choose the VPC network settings you want the Auto Scaling group to use and giving you options for launching On-Demand and Spot Instances (if you chose a launch template). 

1. In the **Network** section, for **VPC**, choose the VPC that you used for your load balancer. If you chose the default VPC, it is automatically configured to provide internet connectivity to your instances. This VPC includes a public subnet in each Availability Zone in the Region. 

1. For **Availability Zones and subnets**, choose one or more subnets from each Availability Zone that you want to include, based on which Availability Zones the load balancer is in. For more information, see [Considerations when choosing VPC subnets](asg-in-vpc.md#as-vpc-considerations).

1. [Launch template only] In the **Instance type requirements** section, use the default setting to simplify this step. (Do not override the launch template.) For this tutorial, you will launch only On-Demand Instances using the instance type specified in your launch template.

1. Choose **Next** to go to the **Configure advanced options** page. 

1. To attach the group to an existing load balancer, in the **Load balancing** section, choose **Attach to an existing load balancer**. You can choose **Choose from your load balancer target groups** or **Choose from Classic Load Balancers**. You can then choose the name of a target group for the Application Load Balancer or Network Load Balancer you created, or choose the name of a Classic Load Balancer.

1. (Optional) For **Health checks**, **Additional health check types**, select **Turn on Elastic Load Balancing health checks**.

1. (Optional) For **Health check grace period**, enter the amount of time, in seconds. This amount of time is how long Amazon EC2 Auto Scaling needs to wait before checking the health status of an instance after it enters the `InService` state. For more information, see [Set the health check grace period for an Auto Scaling group](health-check-grace-period.md). 

1. When you have finished configuring the Auto Scaling group, choose **Skip to review**. 

1. On the **Review** page, review the details of your Auto Scaling group. You can choose **Edit** to make changes. When you are finished, choose **Create Auto Scaling group**.

After you have created the Auto Scaling group with the load balancer attached, the load balancer automatically registers new instances as they come online. You have only one instance at this point, so there isn't much to register. However, you can add additional instances by updating the desired capacity of the group. For step-by-step instructions, see [Change the desired capacity of your Auto Scaling group](ec2-auto-scaling-scaling-manually.md#change-desired-capacity). 

## Step 3: Verify that your load balancer is attached
<a name="as-register-lbs-verify-console"></a>

**To verify that your load balancer is attached**

1. From the [Auto Scaling groups page](https://console.aws.amazon.com/ec2/v2/home?#AutoScalingGroups) of the Amazon EC2 console, select the check box next to your Auto Scaling group.

1. On the **Details** tab, **Load balancing** shows any attached load balancer target groups or Classic Load Balancers.

1. On the **Activity** tab, in **Activity history**, you can verify that your instances launched successfully. The **Status** column shows whether your Auto Scaling group has successfully launched instances. If your instances fail to launch, you can find troubleshooting ideas for common instance launch issues in [Troubleshoot issues in Amazon EC2 Auto Scaling](CHAP_Troubleshooting.md).

1. On the **Instance management** tab, under **Instances**, you can verify that your instances are ready to receive traffic. Initially, your instances are in the `Pending` state. After an instance is ready to receive traffic, its state is `InService`. The **Health status** column shows the result of the Amazon EC2 Auto Scaling health checks on your instances. Although an instance may be marked as healthy, the load balancer will only send traffic to instances that pass the load balancer health checks.

1. Verify that your instances are registered with the load balancer. Open the [Target groups page](https://console.aws.amazon.com/ec2/v2/#TargetGroups) of the Amazon EC2 console. Select your target group, and then choose the **Targets** tab. If the state of your instances is `initial`, it's probably because they are still in the process of being registered, or they are still undergoing health checks. When the state of your instances is `healthy`, they are ready for use.

## Step 4: Next steps
<a name="as-lbs-app-next-steps"></a>

Now that you have completed this tutorial, you can learn more:
+ Amazon EC2 Auto Scaling determines whether an instance is healthy based on the status of the health checks that your Auto Scaling group uses. If you enable load balancer health checks and an instance fails the health checks, your Auto Scaling group considers the instance unhealthy and replaces it. For more information, see [Health checks](ec2-auto-scaling-health-checks.md).
+ You can expand your application to an additional Availability Zone in the same Region to increase fault tolerance if there is a service disruption. For more information, see [Add an Availability ZoneRemove an Availability Zone](as-add-az-console.md).
+ You can configure your Auto Scaling group to use a target tracking scaling policy. This automatically increases or decreases the number of instances as the demand on your instances changes. This allows the group to handle changes in the amount of traffic that your application receives. For more information, see [Target tracking scaling policies](as-scaling-target-tracking.md). 

## Step 5: Clean up
<a name="as-lbs-app-clean-up"></a>

After you're finished with the resources that you created for this tutorial, you should consider cleaning them up to avoid incurring unnecessary charges.

**To delete your Auto Scaling group**

1. Open the [Auto Scaling groups page](https://console.aws.amazon.com/ec2/v2/home?#AutoScalingGroups) of the Amazon EC2 console.

1. Select the check box next to your Auto Scaling group.

1. Choose **Delete**. 

1. When prompted for confirmation, type **delete** to confirm deleting the specified Auto Scaling group and then choose **Delete**.

   A loading icon in the **Name** column indicates that the Auto Scaling group is being deleted. When the deletion has occurred, the **Desired**, **Min**, and **Max** columns show `0` instances for the Auto Scaling group. It takes a few minutes to terminate the instance and delete the group. Refresh the list to see the current state. 

Skip the following procedure if you would like to keep your launch template.

**To delete your launch template**

1. Open the [Launch templates page](https://console.aws.amazon.com/ec2/v2/#LaunchTemplates) of the Amazon EC2 console.

1. Select your launch template.

1. Choose **Actions**, **Delete template**. 

1. When prompted for confirmation, type **Delete** to confirm deleting the specified launch template and then choose **Delete**.

Skip the following procedure if you would like to keep your launch configuration.

**To delete your launch configuration**

1. Open the [Launch configurations page](https://console.aws.amazon.com/ec2/v2/home?#LaunchConfigurations) of the Amazon EC2 console.

1. Select your launch configuration.

1. Choose **Actions**, **Delete launch configuration**.

1. When prompted for confirmation, choose **Delete**.

Skip the following procedure if you want to keep the load balancer for future use. 

**To delete your load balancer**

1. Open the [Load balancers page](https://console.aws.amazon.com/ec2/v2/#LoadBalancers) of the Amazon EC2 console.

1. Choose the load balancer and choose **Actions**, **Delete**.

1. When prompted for confirmation, choose **Yes, Delete**.

**To delete your target group**

1. Open the [Target groups page](https://console.aws.amazon.com/ec2/v2/#TargetGroups) of the Amazon EC2 console.

1. Choose the target group and choose **Actions**, **Delete**.

1. When prompted for confirmation, choose **Yes, Delete**.

## Related resources
<a name="tutorial-ec2-auto-scaling-load-balancer-related-resources"></a>

With CloudFormation, you can create and provision AWS infrastructure deployments predictably and repeatedly, by using template files to create and delete a collection of resources together as a single unit (a *stack*). For more information, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

For a walkthrough that uses a stack template to provision an Auto Scaling group and Application Load Balancer, see [Walkthrough: Create a scaled and load-balanced application](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough-autoscaling.html) in the *AWS CloudFormation User Guide*. Use the walkthrough and sample template as a starting point to create similar templates to meet your needs.