How to change instance type in AWS ECS cluster?

To do it without any downtime:

  1. Create a copy of the Launch Configuration used by your Auto Scaling Group, including any changes you want to make.
  2. Edit the Auto Scaling Group to:
  • Use the new Launch Configuration
  • Desired Capacity = Desired Capacity * 2
  • Min = Desired Capacity
  1. Wait for all new instances to become 'ACTIVE' in the ECS Instances tab of the ECS Cluster
  2. Select the old instances and click Actions -> Drain Instances
  3. Wait until all the old instances are running 0 tasks
  4. Edit the Auto Scaling Group and change Min and Desired back to their original values

Yes, you can achieve this in CloudFormation.

  • Click on the Stack corresponding to your ECS-Cluster.
  • Click Update Stack
  • Use radiocurrent 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:

  1. Make a copy of the cluster Launch Configuration and update the 'Instance Type'.
  2. Adjust the cluster Auto Scaling Group to point to your new Launch Configuration.
  3. 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.