IT

ALL IT Technology Information

AWS Autoscaling | AWS Autoscaling And Load Balancing | AWS Tutorial For Beginners

 AWS Autoscaling | AWS Autoscaling And Load Balancing | AWS Tutorial For Beginners 


AWS Auto Scaling continually monitors your applications to make sure that they are operating at your desired performance levels. When demand spikes, AWS Auto Scaling automatically increases the capacity of constrained resources so you maintain a high quality of service.

  • Step 1: Create a launch template
  • Step 2: Create a single-instance Auto Scaling group
  • Step 3: Verify your Auto Scaling group
  • Step 4: Terminate an instance in your Auto Scaling group
  • Step 5: Next steps
  • Step 6: Clean up





















                                 

 

Step 1: Create a launch template

In this step, you sign in to the Amazon EC2 console with your AWS account credentials and 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.

Note

To use a launch configuration instead, see Create a launch configuration.

To create a launch template
  1. Open the Launch templates page of the Amazon EC2 console.

  2. 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.

  3. Choose Create launch template.

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

  5. Under Auto Scaling guidance, select the check box.

  6. 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.

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

    Note

    If your account is less than 12 months old, you can use a t2.micro instance for free within certain usage limits. For more information, see AWS free tier

  8. (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.

  9. For Network settingsSecurity groups, 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.

  10. You can leave Advanced network configuration empty. Leaving the setting empty creates a primary network interface with IP addresses that we select for your instance based on the subnet to which the network interface is established. If instead you choose to configure a network interface, the security group must be a part of it.

  11. Choose Create launch template.

  12. On the confirmation page, choose Create Auto Scaling group.







                           
To create a launch configuration
  1. Open the Launch configurations page of the Amazon EC2 console. When prompted for confirmation, choose View launch configurations to confirm that you want to view the Launch configurations page.

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

  3. Choose Create launch configuration, and then enter my-first-launch-configuration in the Name field.

  4. For Amazon machine image (AMI), choose an AMI. To find a specific AMI, you can find a suitable AMI, make note of its ID, and enter the ID as search criteria.

    To get the ID of the Amazon Linux 2 AMI:

    1. Open the Amazon EC2 console.

    2. On the left navigation pane, under Instances, choose Instances, and then choose Launch instances.

    3. On the Quick Start tab of the Choose an Amazon Machine Image page, note the ID of the AMI next to Amazon Linux 2 AMI (HVM). Notice that this AMI is marked "Free tier eligible."

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

    Note

    If your account is less than 12 months old, you can use a t2.micro instance for free within certain usage limits. For more information, see AWS free tier

  6. Under Additional configuration, for Advanced detailsIP address type, make a selection. To provide internet connectivity to instances in a VPC, choose an option that assigns a public IP address. If an instance is launched into a default VPC, the default is to assign a public IP address. If you want to provide internet connectivity to your instance but aren't sure whether you have a default VPC, choose Assign a public IP address to every instance.

  7. For Security groups, choose an existing security group. If you leave 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.

  8. For Key pair (login), choose an option under Key pair options as instructed. Connecting to an instance is not included as part of this tutorial. Therefore, you can select Proceed without a key pair unless you intend to connect to your instance using SSH.

  9. Choose Create launch configuration.

  10. Select the check box next to the name of your new launch configuration and choose ActionsCreate Auto Scaling group.






Step 2: Create a single-instance Auto Scaling group

Now use Amazon EC2 Auto Scaling to create an Auto Scaling group and add the launch template or launch configuration to the group. Also include information such as the VPC subnets for the instances.

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

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

  2. 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).

  3. 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.

  4. 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.

  5. [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 one On-Demand Instance using the instance type specified in your launch template.

  6. 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.

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





Step 3: Verify your Auto Scaling group
To verify that your Auto Scaling group has launched an EC2 instance
  1. Open the Auto Scaling groups page of the Amazon EC2 console.

  2. 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.

  3. 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 PreInService. 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.

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

  5. 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 EC2 instance health check on your instance.




Step 4: Terminate an instance in your Auto Scaling group

Step 6: Clean up







2 comments:

  1. nice post . Thank you for posting something like this keep up the good work
    https://www.protechstart.com/2023/09/what-is-aws-ec2.html

    ReplyDelete
  2. nice post . Thank you for posting something like this keep up the good work

    ReplyDelete