How to Create Autoscaling Group on Amazon Web Service(AWS).
Amazon EC2 Auto Scaling helps you ensure that you have the correct number of Amazon EC2 instances available to handle the load for your application. You create collections of EC2 instances, called Auto Scaling groups. You can specify the minimum number of instances in each Auto Scaling group, and Amazon EC2 Auto Scaling ensures that your group never goes below this size.
- Login to aws portal.
- Click on Services.
- Under Compute select EC2.
- Click on Auto Scaling groups.
- Click on Create Auto Scaling group.
- Provide auto scaling group name.
- We can create auto scaling group using launch template or configuration.
- When select launch template.
- Click on Create a launch template.
- Provide launch template name & template version description.
- Click on Template tag.
- We can add tag for template.
- Select AMI(Amazon Machine image) for EC2 instance.
- Select Instance type like t2.small or t3.medium as per the requirement
- Create or select existing Key Pair.
- Select VPC(virtual private cloud).
- Select existing security group.
- We can add storage(volume) .
- We can add resource tags & network interface for launch template.
- Click on Create launch template.
- When select launch configuration so first create or select existing launch configuration.
- Click on link https://www.hackerxone.com/blog/how-create-launch-configuration-autoscaling-amazon-web-serviceaws for how to create launch configuration.
- Click on Next.
- Select existing VPC.
- Create or select existing Subnet.
- Then click on Next.
- We can attach a existing or new load balancer on auto scaling.
- When we select no load balancer.
- leave all the settings.
- Then click on Next.
- When we select attach a new load balancer.
- Select load balancer type: application or network load balancer.
- Provide load balancer name.
- Select load balancer scheme : internet-facing or internal.
- Select Availability zone & subnets.
- Create or select existing target group.
- Provide key name & value for load balancer.
- Enable monitoring for logs within cloudwatch.
- Then click on Next.
- Provide min or max number of instances required.
- Click on Next.
- Add a Notification.
- Click on Add notification.
- Click on Create a topic.
- Provide a topic name & email address of recipients.
- Click on Next.
- Click on Add tag.
- Provide key name & value for auto scaling.
- Click on Next.
- Review all the configuration.
- Click on Create auto scaling group.
- After sometime auto scaling group is ready.
Create Auto Scaling Group using Shell
- Setup aws-cli on your system so click on link https://www.hackerxone.com/blog/how-install-configure-aws-cli-ubuntu-1804
- Run the following command:
1: To create an Auto Scaling group.
aws autoscaling create-auto-scaling-group –auto-scaling-group-name autoscaling-name –launch-configuration-name launch-config-name –min-size 1 –max-size 2 \ –vpc-zone-identifier “subnet-id1,subnet-id2,subnet-id3”
2: To attach an Application Load Balancer, Network Load Balancer, or Gateway Load Balancer.
aws autoscaling create-auto-scaling-group –auto-scaling-group-name autoscaling-name –launch-configuration-name launch-config-name –target-group-arns target0group-arns –health-check-type ELB \ –health-check-grace-period 300 –min-size 1 –max-size 2 –vpc-zone-identifier “subnet-id1,subnet-id2,subnet-id3”