Create an Auto Scaling group using a launch template - Amazon EC2 Auto Scaling
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Create an Auto Scaling group using a launch template

When you create an Auto Scaling group, you must specify the necessary information to configure the Amazon EC2 instances, the Availability Zones and VPC subnets for the instances, the desired capacity, and the minimum and maximum capacity limits.

To configure Amazon EC2 instances that are launched by your Auto Scaling group, you can specify a launch template or a launch configuration. The following procedure demonstrates how to create an Auto Scaling group using a launch template.

To update the configuration of the EC2 instances after the group is created, you can create a new version of the launch template. After you change the launch template for an Auto Scaling group, any new instances are launched using the new configuration options, but existing instances are not affected. To update the existing instances, terminate them so that they are replaced by your Auto Scaling group, or allow auto scaling to gradually replace older instances with newer instances based on your termination policies.

Note

You can also replace all instances in the Auto Scaling group to launch new instances that use the new launch template. For more information, see Replace Auto Scaling instances.

Prerequisites

  • You must have created a launch template. For more information, see Create a launch template for an Auto Scaling group.

  • You must have IAM permissions to create an Auto Scaling group using a launch template. Your ec2:RunInstances permissions are checked when use a launch template. Your iam:PassRole permissions are also checked if the launch template specifies an IAM role. For more information, see Launch template support.

To create an Auto Scaling group using a launch template (console)

  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/, and choose Auto Scaling Groups from the navigation pane.

  2. On the navigation bar at the top of the screen, choose the same Amazon Web Services Region that you used when you created the launch template.

  3. Choose Create an Auto Scaling group.

  4. On the Choose launch template or configuration page, do the following:

    1. For Auto Scaling group name, enter a name for your Auto Scaling group.

    2. For Launch template, choose an existing launch template.

    3. For Launch template version, choose whether the Auto Scaling group uses the default, the latest, or a specific version of the launch template when scaling out.

    4. Verify that your launch template supports all of the options that you are planning to use, and then choose Next.

  5. On the Choose instance launch options page, under Network, for VPC, choose a VPC. The Auto Scaling group must be created in the same VPC as the security group you specified in your launch template.

  6. For Availability Zones and subnets, choose one or more subnets in the specified VPC. Use subnets in multiple Availability Zones for high availability. For more information, see Considerations when choosing VPC subnets.

  7. If you created a launch template with an instance type specified, then you can continue to the next step to create an Auto Scaling group that uses the instance type in the launch template.

    Alternatively, you can choose the Override launch template option if no instance type is specified in your launch template or if you want to use multiple instance types for auto scaling. For more information, see Auto Scaling groups with multiple instance types and purchase options.

  8. Choose Next to continue to the next step.

    Or, you can accept the rest of the defaults, and choose Skip to review.

  9. (Optional) On the Configure advanced options page, configure the following options, and then choose Next:

    1. To register your Amazon EC2 instances with a load balancer, choose an existing load balancer or create a new one. For more information, see Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group. To create a new load balancer, follow the procedure in Configure an Application Load Balancer or Network Load Balancer from the Amazon EC2 Auto Scaling console.

    2. To enable your Elastic Load Balancing (ELB) health checks, for Health checks, choose ELB under Health check type. These health checks are optional when you enable load balancing.

    3. Under Health check grace period, enter the amount of time until Amazon EC2 Auto Scaling checks the Elastic Load Balancing health status of an instance after it enters the InService state. For more information, see Health check grace period.

    4. Under Additional settings, Monitoring, choose whether to enable CloudWatch group metrics collection. These metrics provide measurements that can be indicators of a potential issue, such as number of terminating instances or number of pending instances. For more information, see Monitor CloudWatch metrics for your Auto Scaling groups and instances.

    5. For Enable default instance warmup, select this option and choose the warm-up time for your application. If you are creating an Auto Scaling group that has a scaling policy, the default instance warmup feature improves the Amazon CloudWatch metrics used for dynamic scaling. For more information, see Set the default instance warmup for an Auto Scaling group.

  10. (Optional) On the Configure group size and scaling policies page, configure the following options, and then choose Next:

    1. For Desired capacity, enter the initial number of instances to launch. When you change this number to a value outside of the minimum or maximum capacity limits, you must update the values of Minimum capacity or Maximum capacity. For more information, see Set capacity limits on your Auto Scaling group.

    2. To automatically scale the size of the Auto Scaling group, choose Target tracking scaling policy and follow the directions. For more information, see Target tracking scaling policies for Amazon EC2 Auto Scaling.

    3. Under Instance scale-in protection, choose whether to enable instance scale-in protection. For more information, see Use instance scale-in protection.

  11. (Optional) To receive notifications, for Add notification, configure the notification, and then choose Next. For more information, see Get Amazon SNS notifications when your Auto Scaling group scales.

  12. (Optional) To add tags, choose Add tag, provide a tag key and value for each tag, and then choose Next. For more information, see Tag Auto Scaling groups and instances.

  13. On the Review page, choose Create Auto Scaling group.

To create an Auto Scaling group using the command line

You can use one of the following commands: