Launching EC2 Spot Instances with Auto Scaling and Amazon CloudWatch
- theblackthreat
- Sep 1, 2021
- 2 min read
EC2 auto scalling group that maintain, scale-up, or scale-down the number of instances needed based
on scaling policies that are defined based on the demands of that particular application.
EC2 allows automatically add or remove the instances as needed. Dynamic scaling responds to
changing demand and predictive scaling automatically schedules the right number of EC2 instances
based on predicted demand.
EC2 Spot Instance : spot instance allows us to request for unused EC2 instances in the lower cost.
To create the EC2 Autoscalling we need to create load balancers first.
Creating a Load balancer:
Step 1: EC2 Spot Instances
the load balancer will create requests to EC2 spot Instances.
Create Load Balancer ---> select HTTPS/HTTPs

Step 2: click on Next and then and create a new security load balancer leave it as default and click on
next.---> add configure routing.

Step 3: Register for targets ----> review and create.


Creating the launch template for the Amazon EC2 Auto Scaling Group
Step 1: Creating a launch configuration (this will create the configuration of instances that EC2 spot
wil create later if needed.)
Step 2: Navigate ot EC2--->Lauch cofiguration(scroll down)


Step 3: Choose key pair then click on Create launch configuration.
Step 4: Go to the dashboard of launch configuration and click on instance then go to action click on
create Autoscalling group.
EC2 >>Auto Scaling groups>>Create Auto Scaling group\
· Step 1 >> Choose launch template or configuration

Step 2 >> Configure settings and Select all Subnets


Click on next and enable instance scal protection.

We have Created Autoscalling group so we need to check wheather it’s working or not.
Monitor and test the Auto Scaling group
Step 1: Click on Launch Instances from Templeates select the template that we have created
myTemplate.
Step 2: Set Number of Instances that you want to run at a time after some time all instances are
running

Step 3:Click on the Details for all setup we have done then click on Management Instances

all Instances are successfully handled by Scaling groups.
--------------------------------------------------------------------------------------------------------------------------
Amazon CloudWatch
Amazon CloudWatch is a monitoring and management service that provides data and actionable
insights for AWS, hybrid, and on-premises applications and infrastructure resources. With CloudWatch,
you can collect and access all your performance and operational data in form of logs and metrics from
a single platform.
For our instance spot we can create a cloud watch to monitor services.


Comentários