AWS Classroom Series – 15/May/2021

AWS Launch Configuration

  • Launch configuration is an instance configuration template that auto scaling group uses to launch ec2 instances

  • Lets create a launch configuration with lamp stack to create ec2 instance with size t2.micro and security group which opens 80 port to all Preview

  • Now lets create an auto scaling group

    • Lets choose a minimum of 1 ec2 instance and max of 5 ec2 instances
    • Lets increase the ec2 instances when cpu utilization greater than 80 % for last 5 minutes
    • Lets decrease the ec2 instances when cpu utilization less than 50 % for last 5 minutes Preview Preview Preview Preview Preview Preview
    • To Create artificial stress on CPU we execute the following command in the ec2 instance
    stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 20m -v
    
    • Now if we stop the stress command it will not stress CPU the desired state of the autoscaling will drop back to normal (1)
  • Now go ahead and create a Launch configuration for the apache (lamp) image

Launch Template

  • Lets create a launch template for spring pet clinic Preview Preview
  • Launch templates can be used to create ec2 instances and also can be used in autoscaling group

AWS CLI

  • Refer Here to create an IAM User
  • AWS CLI gives us command line connectivity to AWS
  • AWS CLI commands take the following syntax
aws service <action> [--parameter1 value1 ...  --parametern valuen]
  • To find AWS cli commands, the easier approach is Preview
  • The Whole CLI reference for all the services are listed Refer Here

Next Steps

  • At this moment we can configure our application running inside the ec2 instance to automatically scale.
  • When we have multiple ec2 instances running the same application, we need to configure the load balancer.
  • How to load balance the ec2 instances in Auto Scaling group?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin