<p>You're not asking about <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-groups.html" rel="nofollow noreferrer">auto scaling groups</a>, but I think you probably should be in that paradigm.  If you're using an EC2 instance for doing two tasks where you could use the EC2 instance for one task - or even an EKS workload, you can save dough.</p>
<p>If you're just talking about operations on a single instance, nothing really changes in the cloud.  You need to keep your load (<a href="https://manpages.org/top%5D" rel="nofollow noreferrer">see top</a> commensurate to your number of cores. I have a hard time trusting the mCPU number you gave - I don't really know what that means (this is probably just me not knowing a thing).</p>
<p>I think you will get the most bang for your buck running t2a.smalls (1 CPU, 2GB's of RAM) with one process on them each. Reserve ten of them and let ASG pick up the bursty work.</p>

CC BY-SA 4.0
2023-05-31T18:38:32.707Z
2023-05-31T18:38:32.707Z
Peter Turner
<p>Let's say I want to place my tasks on EC2 instances of type <code>m6i.large</code>, which has 2 vCPU and 8GB of memory.</p>
<p>I have 10 ECS tasks, each requiring 512 mCPU and 512MB of memory. How many EC2 instances do I need to run them?</p>
<pre><code>Total CPU    = 10 x 512 / 1024 = 5 vCPU
Total Memory = 10 x 512 / 1024 = 5 GB
</code></pre>
<p>Do they require 3 instances of <code>m6i.large</code> to meet the CPU demands? Or can they share the same instance (and hopefully not burst at the same time to overload the machine)?</p>

CC BY-SA 4.0
2023-05-31T15:48:31.043Z
can you use auto-scaling groups - to handle the potential bursts?
Peter Turner
CC BY-SA 4.0
2023-05-31T18:04:36.400Z
Yes, I can use Auto Scaling Groups to handle the bursts. However this question is not about ASG. If the ASG decides that 10 is the appropriate number of tasks, then how many EC2 instances do I need to host those 10 instances?
Code Different
<amazon-web-services><amazon-ec2><amazon-ecs>
Number EC2 instances required for tasks
Code Different
# Number EC2 instances required for tasks

(Asked by: username_0 on 2023-05-31)

Let's say I want to place my tasks on EC2 instances of type m6i.large, which has 2 vCPU and 8GB of memory.
I have 10 ECS tasks, each requiring 512 mCPU and 512MB of memory. How many EC2 instances do I need to run them?
Total CPU    = 10 x 512 / 1024 = 5 vCPU
Total Memory = 10 x 512 / 1024 = 5 GB

Do they require 3 instances of m6i.large to meet the CPU demands? Or can they share the same instance (and hopefully not burst at the same time to overload the machine)?

**Tags:** amazon-web-services, amazon-ec2, amazon-ecs

> **Comments:**
> **username_1**: can you use auto-scaling groups - to handle the potential bursts?  
> **username_0**: Yes, I can use Auto Scaling Groups to handle the bursts. However this question is not about ASG. If the ASG decides that 10 is the appropriate number of tasks, then how many EC2 instances do I need to host those 10 instances?  

---

## 1 answers

### Answer by username_1 on 2023-05-31. Score: 0

You're not asking about [auto scaling groups](https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-groups.html), but I think you probably should be in that paradigm. If you're using an EC2 instance for doing two tasks where you could use the EC2 instance for one task - or even an EKS workload, you can save dough.

If you're just talking about operations on a single instance, nothing really changes in the cloud. You need to keep your load ([see top](https://manpages.org/top%5D) commensurate to your number of cores. I have a hard time trusting the mCPU number you gave - I don't really know what that means (this is probably just me not knowing a thing).

I think you will get the most bang for your buck running t2a.smalls (1 CPU, 2GB's of RAM) with one process on them each. Reserve ten of them and let ASG pick up the bursty work.


---

