top of page
  • Writer's pictureParag

AWS Auto Scaling using Launch Template

Updated: Oct 16

Use Auto Scaling to schedule an instance by using launch template.


Objectives:

  • Learn to use Auto Scaling to schedule (scale up and scale down) an instance by using launch template.

  • Learn to create AWS EC2 Launch Template.

Step 1: Create a Linux Web Server AMI using our step wise blog here.

Step 2: Navigate to the Auto Scaling Groups option the left-hand side panel of AWS EC2 console under Auto Scaling.

Click on Create Auto Scaling group.

Configure it as follows:

Name: MyASG

In Launch Template, click on dropdown button and select MyTemplate.

Now click on the button Next.

After clicking on Next, scroll down to Network and select two subnets(AZ) in Availability Zones and subnets and click on Next.

After clicking Next, keep the Configure advanced options default and again click on button Next.

In the Configure Group Size and Scaling Policies enter values as follows:

Desired capacity: 0

Minimum capacity: 0

Maximum capacity: 0

Keep rest values as default and go to Next step.

Further keep all the steps as default and continue to click Next.

Review your Auto Scaling group and click on Create Auto Scaling group button at the bottom right of the page.

Wait till the status of ASG changes from Updating Capacity to -.

Step 3: Select the MyASG created and navigate to Automatic Scaling tab.

Scroll down to Schedule actions and click on Create Schedule action.

Step 4: Create two scheduled actions for auto scaling group.

Create one schedule to ScaleUP.

ScaleUp:

Desired Capacity: 2

Minimum Capacity: 2

Maximum Capacity: 2

Recurrence: Once

Time Zone: Asia/Kolkata

Note: You can select time zone as per your location.

Start time: 2023/10/10 23:25

NOTE: Amazon uses UTC time so ensure setting the start time as per the UTC or select as per your location 5 mins after this creation.

Click on Create button.

Similarly create second schedule to Scaledown.

ScaleDown:

Desired Capacity: 1

Minimum Capacity: 1

Maximum Capacity: 1

Recurrence: Once

Time Zone: Asia/Kolkata

Start time: 2023/10/10 23:30

Note: Set the start time for the ScaleDown schedule 5 mins after ScaleUP

Click on Create button.

Confirm both the events are appropriately corrected and now it shows time specific to your own time zone.

Step 5: Go to the instances option in the left navigation pane of the aws console after 5 mins and check if there are 2 instances created by the auto scaling group to ScaleUp schedule we created.

Step 6: In the same instances page check for the second schedule, we created to ScaleDown after some time. Now the instances should reduce from 2 instances to 1 instance.


Note: If you don’t need the auto scaling group further then make sure to delete the group and also delete the AMI which we created earlier in this lab.



AWS Auto Scaling using Launch Template
.pdf
Download PDF • 748KB


Was this document helpful? How can we make this document better. Please provide your insights. You can download PDF version for reference.



We provide the best AWS training from Pune, India. For aws certification contact us now.

450 views24 comments

Recent Posts

See All
bottom of page