How To Create Auto Scaling in AWS
This blog post will help you create Auto Scaling in AWS, a collection of Amazon Ec2 instances with similar characteristics among them in just a group.
Join the DZone community and get the full member experience.
Join For FreeThis blog post will help you create Auto Scaling in AWS, a collection of Amazon Ec2 instances with similar characteristics among them in just a group. These instances are treated as a logical group for scaling and management purposes.
Requirements
- Account in AWS
Step by Step on How To Create Auto Scaling in AWS
- Log in to the AWS account, is recommended with a user with certain permissions, not with a root user. Use the user’s access link (for example).
![step 1 of create auto scaling in aws: aws account](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172900/aws-account.png)
*Note: The account should be self-completed with a 12-digit number, change your username and password.
- Verify the region in which the infrastructure will be created. In the upper right corner, click on the button with the city name and choose the region, in this case, it will be Virginia.
![step 2 of create auto scaling in aws: choose city and region](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172858/choose-city-and-region.png)
3. Select the EC2 service.
![step 3 of create auto scaling in aws: :EC2 service](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172856/EC2-service.png)
4. First, you must create an image of the instance (AMI), and select “Instances”.
![step 4 of create auto scaling in aws: instances](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172855/instances-1.png)
5. Select the instance.
![step 5:of create auto scaling in aws: select the instance](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172853/select-the-instance.png)
6. Press “Actions”> “Image”> “Create Image”.
![step 6 of create auto scaling in aws: create images](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172852/create-images.png)
7. Assign a name to the AMI, description and activate the option “No reboot”, the latter to prevent the instance from restarting when creating the AMI.
![step 7 of create auto scaling in aws: AMI name](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172850/AMI-name.png)
8. Verify that the AMI has been created successfully, select “AMIs” from the side menu.
![step 8 of create auto scaling in aws: AMIs](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172848/AMIS.png)
9. Check that the “Status” is “available”.
![step 9 of create auto scaling in aws: status available](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172847/status-available.png)
10. The next step is to create the Auto Scaling Group; select “Launch Configurations” from the side menu.
![step 10 of create auto scaling in aws: launch configurations](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172845/launch-configurations.png)
11. Click on “Create AWS Auto Scaling Group”.
![step 11 of create auto scaling in aws: create aws auto scaling group](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172843/create-aws-auto-scaling-group.png)
12. Press “Create Launch Configuration”.
![step 12 of create auto scaling in aws: create launch configuration](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172841/create-launch-configuration-1.png)
13. Select “My AMIs” and the previously created AMI.
![step 13 of create auto scaling in aws: my AMIs](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172839/my-AMIs.png)
14. Select the type of instance desired for the slave instances (slaves) created by the Auto Scaling Group and press “Next: Configure details”.
![step 14 of create auto scaling in aws: configure details](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172837/configure-details.png)
15. Assign a name to the launch configuration (Launch configuration).
![step 15 of create auto scaling in aws: launch configuration](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172836/launch-configuration.png)
16. In advanced details, in the “User data” section write the commands to mount the EFS and select the option where no public IP is assigned to any instance. Finally press “Next: Add Storage”.
![step 16 of create auto scaling in aws: add storage](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172834/add-storage.png)
*Note: The MOUNT command is the same that AWS provided when mounting the EFS on the master instance, be sure to mount the desired one.
- The volume (disk) that will be assigned to the instances created by the Auto Scaling group will have a copy of the volume of the master instance. Press “Next: Configure Security group”.
![step 17 of create auto scaling in aws: Configure Security group](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172832/Configure-Security-group.png)
18. Select the option “Select an existing security group” to assign the same Security Group of the master instance, in this case, it will be sg-78920606.
![Select an existing security group](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172830/Select-an-existing-security-group.png)
19. Check that the settings are correct and create the launch configuration by pressing “Create launch configuration”.
![Create launch configuration](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172828/Create-launch-configuration.png)
*Note: The warning is caused by the Security Groups because it can ensure even more to the instances and infrastructure in general, but taking this tutorial as a basic one can be advanced in this way.
- Choose an existing key and accept that you have access to it; create the launch configuration.
![create the launch configuration](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172827/create-the-launch-configuration.png)
The next thing is to configure the AWS Auto Scaling group; Name the group of instances, determine the number of instances with which it will start, select the VPC and the private subnet, you must also specify that the traffic will come from a Load Balancer so that the “slave” instances are automatically added to it. Press “Next: Configure scaling policies.”
![Configure scaling policies](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172825/Configure-scaling-policies.png)
22. Adjust group policies.
- Determine the maximum number of possible instances in the group.
![Adjust group policies](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172823/Adjust-group-policies.png)
2. Add a new alarm for the increase of instances:
Create a topic (topic) to which the name is assigned and emails to which they will be notified (if they are two or more, separate them with commas), establish the maximum percentage in a period of time, name the alarm, and create it.
![create alarm](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172821/create-alarm.png)
3. In “Take the action” we establish that it increases the number of instances by 1 in 1.
![Take the action](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172819/Take-the-action.png)
4. Add a new alarm for the decrement of instances:
Create a topic (topic) to which the name is assigned and emails to which they will be notified (if they are two or more, separate them with commas), establish the minimum percentage in a period of time, name the alarm, and create it.
![create alarm 1](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172817/create-alarm-1.png)
*Note: Change the “> =” (greater or equal) by a “<=” (less or equal) in the alarm to decrease the number of instances.
5. In “Take the action” we establish that the number of instances should decrease from 1 to 1; press “Next: Configure Notifications”.
![Configure Notifications](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172816/Configure-Notifications.png)
23. If you want to receive notifications when an instance is created or deleted, add a notification. On this occasion, you will not configure an extra alarm. Press “Next: Configure Tags”.
![Configure Tags](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172814/Configure-Tags.png)
24. Optionally you can add a name to the Auto Scaling group, as shown in the following screenshot.
![Auto Scaling group name](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172812/Auto-Scaling-group-name.png)
25. Review the configuration and create the Auto Scaling group.
![create the Auto Scaling group](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172811/create-the-Auto-Scaling-group.png)
26. In a few minutes, you can see in “Instances” the instance that is created automatically.
![Instances](https://images.clickittech.com/2020/wp-content/uploads/2019/01/22172809/Instances.png)
*Note: Wait until your state is “running”.
Those are all the steps that you need to follow to create an AWS AutoScaling Group.
Published at DZone with permission of Alfonso Valdes. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments