How to Create an Autoscaling group of EC2 Instances for high availability
Autoscaling helps the availability of the application you’re trying to launch! AWS EC2 Instance offers so many resources to help with the availability of instances for consumers. In this article I will go over step by step on how to achieve creating an auto scaling group of EC2 Instances for high availability. Part 2 can be FOUND HERE! It is the Advanced & Complex portion for this project where I add target policies for the ASG, load balancers, security groups & more!
The task:
- Create VPC with CIDR
- Create 3 public subnets
- Create an autoscaling group with t2.micro instances (Apache install included)
- Create an application load balancer
- Create web server security groups
- Create a load balancer security group
What I used to complete the task:
- AWS Account
- CLI -command line interface
- knowledge of autoscaling & load balancing
- Apache install
Step 1. Create VPC with CIDR 10.10.0.0/16
Step 2. Create 3 public subnets
- select the VPC you just created in the drop-drown box
Step 3. Create 3 subnets
- create a name for each subnet, chose an Availability Zone for each & the IPv4 CIDR Block for each.
Step 4. Create an autoscaling group using t2.micro instances (Apache install included)
- the first thing you’re going to want to do is create a launch template, and that can be found under the EC2 service
- Next create a name for Launch Template
- Under the Application and OS Images (AMI-Amazon Machine Image) select Amazon Linux AWS (leave everything as it defaults.
- Instance Type, select t2 micro.
- Key Pair (login), I selected one I’ve already created. If you need to create a key pair you have to create one in the EC2 Management Consule & select create new key pair, save the download into a place on your computer that’s easy to access and don’t share the code with anyone.
- Network Settings> common security group (select the one you create for the VPC)> Advanced network configuration, Auto-assign public IP click enable.
Click the Advanced details at the very bottom
- Click the Advanced details at the very bottom>User data> then enter your script. For this project it required an Apache install.
To complete the Auto Scaling follow the red boxes below
Step. 5 Create an Application Load Balancer to distribute traffic to the autoscaling group
That completes this portion of How to Create an Autoscaling group of EC2 Instances for high availability!
Check out PART 2 on that continues on with creating the load balancer & more.
That article can be FOUND HERE!