How to change instance type in AWS ECS cluster?

后端 未结 8 1372
孤独总比滥情好
孤独总比滥情好 2021-02-01 01:34

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

相关标签:
8条回答
  • 2021-02-01 02:06

    This is how 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
    3. Wait for all new instances to become 'ACTIVE' in the ECS Instances tab of the ECS Cluster
    4. Select the old instances and click Actions -> Drain Instances
    5. Wait until all the old instances are running 0 tasks
    6. Edit the Auto Scaling Group and change Min and Desired back to their original values
    0 讨论(0)
  • 2021-02-01 02:11

    This can be achieved by modifying EcsInstanceType in the CloudFormation stack for the ECS instance. Any change to the autoscaling group by hand will be overwritten by the next "Scale ECS Instances" operation.

    0 讨论(0)
  • 2021-02-01 02:11

    Definitely, there are multiple ways to change the instance type as suggested about using launch configurations.

    But beware that, it is a challenge to use multiple launch configuration to attach to ECS cluster that has Container Instances Scaling policies.

    For example, If one is running a cluster with t2.medium type of instances using a launch configuration and have a Auto scaling policy attached to ECS cluster then it can signal only Auto scaling group and not more than 1.

    0 讨论(0)
  • 2021-02-01 02:16

    Yes, you can change the instance type in ECS cluster. I believe you have created ECS cluster manually from AWS GUI. Behind the scene, its creating aws cloud formation template as per your inputs from AWS console(ECS) like VPC, instance type, and size, etc. Please follow the below steps for the same.

    1. Find the cloud formation template with the name "EC2ContainerService-{your-ecs-cluster-name}".
    2. Check the existing setting in the Parameters tab(you can check your instance type here).
    3. Now you need to update the cloud formation. Click on-> Update ->use current template ->next->update the EcsInstanceType variable ->next->next->update stack.
    4. Now your cloud formation update. now you can check in EC2 console that there is a new spot fleet with new instance type.
    0 讨论(0)
  • 2021-02-01 02:21

    Here are the exact steps I took to update the instance type on my cluster:

    • Go to the cluster service, update Number of tasks to 0

    • Go to EC2 -> Launch Configurations -> Actions dropdown -> Copy launch configuration and set the new instance type

    • Go to EC2 -> Auto Scaling Groups -> Edit -> set Launch Configuration to newly created launch configuration

    • Go to EC2 -> Auto Scaling Groups -> Instances -> Detach instance

    • Go to EC2 -> Launch Configurations -> Delete old launch configuration

    • Go to the cluster service, update Number of tasks to your desired count.

    Now when tasks start, it'll be running on the updated EC2 instance type.

    0 讨论(0)
  • 2021-02-01 02:24

    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.

    0 讨论(0)
提交回复
热议问题