How to change instance type in AWS ECS cluster?
I have a cluster in AWS EC2 Container Service. When I've set it up, I used t2.micro instances because those were sufficient for development. Now I'd like to use more powerful instances, like m4.large.
I would like to know whether it is possible to change the instance types only, so I don't need to recreate the whole cluster. I could not find how to do this.
Yes, you can achieve this in CloudFormation.
- Click on the Stack corresponding to your ECS-Cluster.
- Click
Update Stack
- Use radio
current template
,Next
- change EcsInstanceType
-
Next
,Next
,Update
- Upscale your cluster to
2*n
instances - Wait for the
n
new instances of the new type being created - Downscale your cluster to
n
- Or you could just drain and terminate the instances 1 by 1
Yes, this is possible.
The instance types in your cluster are determined by the 'Instance Type' setting within your Launch Configuration. To update the instance type without having to recreate the cluster:
- Make a copy of the cluster Launch Configuration and update the 'Instance Type'.
- Adjust the cluster Auto Scaling Group to point to your new Launch Configuration.
- Wait for your new instances to register in your cluster and your services to start.
You can also add multiple instances types to a single cluster by creating multiple Auto Scaling Groups linked to different Launch Configurations. Note however that you can't copy Auto Scaling Groups easily within the console.