Bobcares

Change Container Instance Type in ECS – How to do it

by | Aug 21, 2021

To change Container Instance Type in ECS we need to update container instances launched in an ECS cluster through the AWS CloudFormation stack.

Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.

Today, let us see how we can perform the same.

 

Change Container Instance Type in ECS

To change the container instance type, our Support Techs recommend the steps below:

 

  • Update container instances launched in an ECS cluster

The following steps apply only to ECS clusters created with resources that internally create an underlying AWS CloudFormation stack.

The stack has a name in the following format: EC2ContainerService-yourClusterName.

These steps don’t apply to empty ECS clusters or to customized approaches for provisioning container instances.

Update the value of the EcsInstanceType parameter in the AWS CloudFormation stack:

  1. Initially, we open the AWS CloudFormation console.
  2. Then we select the stack that contains the ECS cluster.
  3. After that, we select Actions > Update Stack > Use current template > Next.
  4. For EcsInstanceType, we set a value that’s appropriate for the instance type in the container instance and then select Next.
  5. We then skip the Options section, select Next, and then select Update.

Replace the old container instances in the cluster:

1. From the above, if we complete steps 1-4, we update the AWS CloudFormation stack.

2. For AsgMaxSize, we enter a parameter value that’s double the current size.

3. Then we open the Amazon ECS console.

4. From the navigation pane, we select Clusters and then select the cluster.

5. After that, we select the ECS Instances tab, and then select the container instance IDs for the old container instances that we want to replace.

6. To drain the instances, we select Actions > Drain instances.

7. On the ECS Instances tab, we verify that the Running tasks count is 0 for the old container instances.

8. Then in the navigation pane, we select Clusters, and then select the cluster.

9. We select the ECS Instances tab, select the container instance IDs of the old container instances, and then select Deregister.

10. In the AWS CloudFormation template, we set the value of AsgMaxSize to the original value to terminate the older container instances.

 

  • Update container instances launched manually in an ECS cluster

1. To do so, we copy the launch configuration of the Auto Scaling group, and then name the new launch configuration.

2. After that we change the instance type.

3. In the Auto Scaling section, we select Auto Scaling Groups. Then, we select the Auto Scaling group for the container instance.

4. Then we go ahead with Actions > Edit.

5. In the pop-up window, we select the launch configuration that we created in step 1.

6. For Desired Capacity, we enter a value that’s double the size of the current value and then update the value of Max as needed.

7. In the navigation pane of the Amazon ECS console, we select Clusters, and then the cluster.

8. From the ECS Instances tab, we select the container instance IDs for the old container instances that we want to replace.

9. Then we go to the Actions menu > Drain instances.

10. On the ECS Instances tab, for the old container instances, we verify that the Running tasks count is 0.

11. From the ECS Instances tab, we select the container instance IDs for the old container instances, and then select Deregister.

12. In the Amazon EC2 console, in the Auto Scaling section, we select Auto Scaling Groups.

13. Here, we select Actions > Edit.

14. In the Auto Scaling group configuration, we set the Desired Capacity and Max to their original values, and then save the changes.

[Stuck in between? We’d be happy to assist]

 

Conclusion

In short, we saw how our Support Techs change the Container Instance type in ECS.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.