AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips

AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips

AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Today we are discussing a complete end to end AWS ASG (Auto Scaling and Auto Scaling group) in our 100DayOfRandomLearning series. 

What is auto-scaling in AWS?

Auto-scaling is a service offered by Amazon Web Services in which scale-in and scale-out of instances will be handled automatically as per the launch configuration/template specified. 

Auto-scaling is one of the best services offered by AWS.

Best Practice:
In order to work with auto-scaling smoothly, there is a need to deploy a load balancer as well.

Let's dive into the hands-on without wasting any more second - 
we will go through the theory (definition, concepts, and many more) simultaneously. 


Prerequisites -

No instance is running.

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips 

Application Load Balancer is running with no registered targets

On Day 2, we learn how to create a Load Balancer in AWS with complete hands-on and labs.


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification TipsDay 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips







Configure the Security Group for EC2 and ALB ( Application Load Balancer )

Click here for Complete Security Group Setup.

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Setup an Auto-Scaling 

Network Diagram | Autoscaling | Randomskool

Once all the prerequisites are fulfilled we are good to set up auto-scaling and launch configuration.

Go to EC2 Dashboard > Auto Scaling > Launch Configuration > Create Launch Configuration


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips
In launch configuration, click on "Start Using Launch Templates" present in the top information bar.

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips



******Random Bytes******

Difference between Launch Configuration and Launch Templates

    Launch Configuration - 
  • launch configuration is an instance configuration template that an Auto Scaling group uses to launch EC2 instances.
  • One launch configuration for an Auto Scaling group at a time.
  • You can't modify a launch configuration after you've created it.
    Launch Template -
  • A launch template is similar to a launch configuration, in that it specifies instance configuration information.
  • Launch template allows you to have multiple versions of a template.
  • Versioning helps in reusing it to create other templates or template versions.
  • Launch template creates an auto-scaling group that launches both Spot and On-Demand Instances or that specifies multiple instance types.
Even AWS also recommends that everyone create Auto Scaling groups from launch templates to ensure that you're getting the latest features from Amazon EC2

********************

Configure launch template - 
   
    Enter the below details: 
    Enter the template name

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Specify the AMI (t2.micro if you are free tier eligible)

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Enter the AMI 

Enter the Instance type

Specify the Key-pair

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Under Networking section -  ( Choose VPC, Subnet and Security Group )

Select the storage volume

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Under Advanced details - go to User Data > type the script mentioned in the image.

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Hurrah !!!! We have created our first launch template successfully. 



Once the template created successfully, go to view templates and verify all the configuration is correct.

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Go to EC2 Dashboard > Go to Auto Scaling > Click on Auto Scaling Group.

Click on Create Auto Scaling Group

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Enter the Auto Scaling Group and Select the latest created launch configuration. > Click on Next

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Choose Purchase option and in Network, option Select VPC, and subnet ( for high availability select more than one subnets).

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Enable load balancing - for high availability if selected application load balancer then needs to choose the target group as well. 

Select the health checks - for additional health checks to enable ELB.

Change the health check grace period if required otherwise leave as it is.

Additional Settings - Enable Monitoring ( in order to collect cloudwatch logs for triggering alarms ) 

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips



******Random Bytes******

Difference between EC2 and ELB health checks? 

EC2 Health Checks - 
It is configured by default in EC2 instances.
It checked the status of hardware and network configuration, if anything found misconfigured it marked the instance as faulty. 
Works on the instance level.

ELB Health Checks -
Using to check the availability of instances by pinging and verified whether the instance is accepting connection or not. 
It checked whether the instance returns a 200 status code or not.
Works on the App-level instead of checking the instance it smartly verifies whether the application is working or not.

What is the Health Check Grace Period?
The amount of time until EC2 Autoscaling performs the first health check on new instances after they are put in-service.

*************************

Choose Group size - Desired, Min and Max 

Choose Scaling Policies - Target tracking Scaling Policy or None ( if choose none, you can select scaling policy after the creation of the Auto Scaling group.



Optional - Instance Scale-in Protection ( Protect instance from automatic scale-in)

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Review the auto-scaling group configuration if all good then click on Create Autoscaling group

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Hurrah !!! Our First Auto Scaling Group created successfully.

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips



******Random Bytes******

Difference Between Desired, Min, and Max Capacity in the auto-scaling group?

Desired Capacity
No. of instances launched first as per the number specified in the desired capacity.
The desired capacity can be varied as per the Scaling policies defined.
Desired capacity must be between min and max.

Min Capacity-
No. of an instance will never decrease as per the number specified in min capacity.

Max Capacity-
No. of an instance will never be increasing as per the number specified in max capacity.

Difference between Auto-Scaling policies?

Simple Scaling - 
The simple scaling policy is a simple straightforward policy in which you need to add cloud watch metrics such as CPU utilization if your specified metric reaches the threshold then either two actions will performed add or remove the number of instances.

Step Scaling -
It provides more flexibility in which we can define multiple responses/conditions, if either of the responses set to true then adds or removes actions will be triggered.
Benefits - can help in defining multiple responses.

Target Tracking Scaling -
It is one of the famous scaling policies in which all we need to specify the condition rest will be taken care of by the policy. 
No need to mention add or remove action it will automatically add or remove an instance if it reaches the threshold/conditions. 
It is self-scaling ( add or remove automatically )
It's an algorithm written in such a manner - that this policy learns from the cloud watch metric and takes the appropriate actions.

*************************

Validation

Open the Auto Scaling group > Go to activity > Check whether any instance status is present either preservice or successful.

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


In order to change scaling policy > Go to automatic scaling > Select the existing one - delete it and add a new scaling policy ( either step, simple and target tracking )

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips
Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Go to EC2 Dashboard > Check the Instance are present or not

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


EC2 Dashboard > Go to Load Balancer > Open the target group > Click on target > Verify whether the instance is registered in load balancer or not.


EC2 Dashboard > Go to Load Balancer > from description > copy the DNS


Verify-in Browser whether the DNS is working.


Start playing with an auto-scaling group size value -

1. Change the Desired capacity value
 
Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


2. Check the changes in auto-scaling group > Activity tab

Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips


3. Check whether the new instance is reflecting in the instance 
management tab.
 
Day 3 - AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips

AWS Study Combo Pack
 -

0 Response to "AWS Auto Scaling Zero to Hero | AWS ASG | Hands-on | Certification Tips"

Post a Comment

Hey Random,

Please let me know if you have any query :)

Adsense

Adsense

Adsense

Adsense