简体   繁体   中英

Adjusting AWS ECS spot request

I have AWS ECS cluster but spot instance type I selected is too small.

I can't find way to adjust Spot Fleet request ID or change Instance type(s) for Spot Fleet request cluster is using.

  • Do I have to create a new cluster with a new spot fleet request?
  • Is there any cli option to adjust cluster?
  • Do I have manually order EC2 with ECS optimized AMI ?

UPDATE In question How to change instance type in AWS ECS cluster? that sounds similar advised to copy Launch Configuration. But I have no Launch Configuration

在此处输入图片说明

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 cloudformation 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 cloudfromation 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 cloudformation. Click on-> Update ->use current template ->next-> update the EcsInstanceType variable ->next->next->update stack.
  4. Now your cloudformation update. now you can check in EC2 console that there is a new spot fleet with new instance type.

There is no way of changing the instance types' requested by a spot fleet after its been created.

If you want to run you ECS workload on another instance type, create a new spot fleet (with instances which are aware of your ECS cluster).

When the spot instances spin up, they will register with your ECS Cluster.

Once they are registered, you can find the old instances (in the ECS Instances tab of the cluster view) and click the checkbox net to them.

Then, go to Actions -> Drain instances

This tells ECS that you no longer wish to use these instances. New tasks will now be scheduled on the new instances.

Once all the tasks are running on the new instances, you can delete the old spot fleet.

On the subject of launch configurations. There are two ways of creating collections of spot instances.

  • Through a Spot Fleet (which is what you're doing)
  • Through and Auto Scaling Group (ASG)

ASGs allow you to supply a launch configuration (basically a set of instructions to set up an EC2 instances.

Spot Fleets only allow you to customise the instance on creation via User Data.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html

Because you're using Spot Fleets, Launch Configurations are really a consideration for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM