title: AWS mixed cluster with EC2 and fargate instances
body: <p>I am using AWS CDK for my Infrastructure-as-Code (CDK code fragments in C# .NET below).</p>
  <p>I have a VPC created as follows:</p>
  <pre><code>        // vpc (testing)
          this.vpc = new Vpc(this, &quot;vpc&quot;, new VpcProps() {
              MaxAzs = 1,
              NatGateways = 1
          });
  </code></pre>
  <p>I have a cluster created as follows:</p>
  <pre><code>        // cluster
          this.cluster = new Cluster(this, &quot;cluster&quot;, new ClusterProps() {
              Vpc = this.vpc
          });
  </code></pre>
  <p>I have a worker definition for a Fargate Task as follows:</p>
  <pre><code>        // worker
          this.workerDefinition = new FargateTaskDefinition(this, 
              &quot;worker-definition&quot;, 
              new FargateTaskDefinitionProps() {
                  Cpu = 256,
                  MemoryLimitMiB = 512
              }
          );
  </code></pre>
  <p>I have the Fargate worker service as follows that ties the worker service to the cluster with the instance count and task definition:</p>
  <pre><code>            var worker = new FargateService(this, &quot;worker&quot;, new FargateServiceProps() {
                  Cluster = this.cluster,
                  DesiredCount = k,       // up to k worker instances
                  TaskDefinition = this.workerDefinition
              });
  </code></pre>
  <p><strong>Questions:</strong></p>
  <ol>
  <li>I want to use k reserved EC2 instances in the cluster as a minimum. Should I create those EC2 instances and add them to the cluster?</li>
  <li>If I call ecs.runTask() using a FARGATE launch type, would the Fargate service be launched on one of the pre-spun EC2 instances until the limit of k is reached (and then, I intend to use an autoscaling rule based on workload to spin up FARGATE_SPOT instances on-demand)?</li>
  <li>Is my understanding that EC2 instances pre-created and added to the cluster will be used to run the FARGATE tasks correct?</li>
  <li>How does the scheduler decide where to place the tasks? Suppose my task is re-entrant (ie., I can run multiple instances on the same machine), how does Fargate know (or how do I instruct it so that it would know) that it can place multiple instances on the same machine (ie., does Fargate automatically use CPU/IO utilization as a metric for packing tasks on a container)?</li>
  </ol>