EC2 Autoscaling Group not capacity tracking vCPU

0

Current have an ASG configured to desired/min/max of 2/2/10 with the 'Desired Capacity Type' set to vCPU.

Capacity

In addition, it is set to use attribute selection for choosing instances to scale in.

Attribute Selection

According to documentation, as far as I can tell this means the ASG should have a pool of instances that have a minimum of 2 vCPUs and scales up to 10 vCPU.

However it seems the ASG is still treating this as a unit rather than vCPU, it launches 2 instances with 2 vCPU each, and it will not allow terminating one of the instances as that would put it outside of the range.

AutoScalingGroup dev-foo has min-size=2, max-size=10, and desired-size=2. The new size would be out of the min or max range. To detach 2 capacity units, please update the AutoScalingGroup sizes appropriately.

Am I misunderstanding what vCPU capacity type does?

Brent G
gefragt vor einem Monat85 Aufrufe
4 Antworten
1
Akzeptierte Antwort

So I think it's a UI/UX Issue.

I had enabled "Include On-Demand base capacity" and set it to 1. It is described as: "Specify how much On-Demand capacity the Auto Scaling group should have for its base portion before scaling by percentages. The maximum group size will be increased (but not decreased) to this value."

It is labelled as "On-Demand Instances". However it appears if you change capacity type to vCPUs, while the box still says On-Demand Instances it's counting it as vCPUs. So when I had it set to 1, it would launch the 1 on demand instance, but it would ignore how many vCPU that instance had and counted it as 1. Then since 1 < 2, it'd launch another instance.

So even though it says: 2 instances it's actually vCPU.

This would explain why on a mirrored ASG set to 4/4/32 it gave us 3 instances.

1 On-Demand instance w/ 2 vCPU (Counts a 1, 1<4 so launch another)

1 Spot Instance w/ 2 vCPU (Counts as 2, 3<4 so launch another)

1 Spot Instnnce w/ 2 vCPU (Counts as 2, 5>4 so stop launching)

So even though the first On-Demand instance has 2 vCPU since 1 was put in the box, any additional vCPU seems to not be accounted for.

In your instance selection if you put in a minimum vCPU count of 8 instead of 2, would you get 16 vCPUs for a desired capacity of 8 if you put anything less than 8 in the number of "On Demand Base Instances"

Brent G
beantwortet vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat
  • Hi Brent, this is very close, but not quite what's happening. I added an answer below with details. When DesiredCapacityType = vCPU, everything is counted in vCPUs, there isn't a mix of Units and vCPUs. However, Spot and OnDemand capacities are counted separately, which leads to the behaviors you saw

0

Hi Brent,

I tested the Desired Capacity Type feature in my AWS account, and it worked as expected. When set to vCPU, it only launched one instance that met the t3a requirement. I also experimented with switching the Desired Capacity Type between "number of instances," "vCPU," and other options. In each case, the behavior was as expected.

I recommend reviewing the following areas to investigate the issue you're encountering:

AutoScaling settings: Ensure all configurations are correct.

Activity History: Check for any relevant scale-in or scale-out events.

AutoScaling protections: Review if any scale-in or scale-out protections in place might be affecting the behavior.

CloudTrail logs: Examine the event logs for more insights into what might be causing the behavior you're seeing.

Capacity Settings

Instance Attribute Settings

Launched Instance

ASG Acitivity History

profile picture
beantwortet vor einem Monat
  • Settings are set to what I had in the screenshot. I took out burstable instances on the off chance maybe it was counting their vCPU weirdly. There is no maintenance policy, there is no scale-in protection, Termination policy is default, Cooldown is 300 seconds, default warmup is 120 seconds.

    If I manually terminate an instance I get the expected message:

    At 2024-09-05T15:16:24Z an instance was taken out of service in response to an EC2 health check indicating it has been terminated or stopped.

    But then it wants to start up another one:

    At 2024-09-05T15:16:26Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 2 to 3.

    So despite having desired and minimum vCPU set to 2, it's launched a c6a.large and a m6a.large for a total of 4 vCPU. So the 'increasing capacity from 2 to 3' makes even less sense.

0

Hi Brent,

AWS ASG community is looking into your question. I have also tried to see similar to your behaviour. I could not see it initially till I created a launch template with 1vCPU requirement (t2.micro) and then overrode the template with 2vCPU desired capacity type. Then I saw something interesting happening, for some reason the ASG started to use weight capacity and spinning up 2 instances with 2vCPU instead of 1. Did you also override the initial template?

I am actively looking into the question, as much as possible information for us to narrow down the behavior would be greatly appreciated.

AWS
Katya_Z
beantwortet vor einem Monat
  • The launch template doesn't specify any instance type settings, only AMI, Network, Volumes, Instance Profile, User Data, everything else is set to 'Dont include'. I have an open support case where they replicated this, for reference it's 172549417300934.

0

When you have a mix of Spot and OnDemand, the 2 capacity pools are treated separately. In your scenario with Desired=2; OnDemandBase=1; and OnDemandPercentAboveBase=0% This means the ASG wants at least 1 Desired Capacity of OnDemand, and at least 1 Desired Capacity of Spot

Since the instances being launched were weight 2 (2vCPUs), it launched 1 instance in OnDemand, saw that the OnDemand portion of the Desired was fulfilled, and then moved on to Spot where the same thing happened.

Similarly for your second example where Desired was 4:

  • OnDemand portion of the Desired is 1; so launch 1 instance (weight 2): Done, at least 1 OnDemand Desired is fulfilled (2 capacity)
  • Spot portion of the Desired is 3; so launch 1 instance (weight2); nope, need more; launch another: Done, at least 3 Spot Desired is fulfilled (4 capacity)
AWS
EXPERTE
beantwortet vor einem Monat

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen