Answers: <p>Why don't you use <a href="https://www.terraform.io/" rel="nofollow noreferrer">Terraform</a> for the purpose? It can launch as many instances you want, create network for you, create security groups, ECS, IAMs or whatever you want to create and terminate easily when you want. This is widely used in industry now.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-01-11T06:40:03.160Z
Answers: 2019-01-11T06:40:03.160Z
Answers: deosha
Answers: <p>Look at <strong><a href="https://aws.amazon.com/fargate/" rel="nofollow noreferrer">AWS Fargate</a></strong> - it lets you run your Docker containers without having to spin up the EC2 instances for an ECS cluster. You simply schedule the Tasks (or Services), each gets is own IP address and they can talk to each other. </p>
  
  <p>You can also use <strong><a href="https://aws.amazon.com/blogs/aws/amazon-ecs-service-discovery/" rel="nofollow noreferrer">AWS Service Discovery</a></strong> to facilitate the registration and lookup of the tasks' IP addresses.</p>
  
  <p>BTW Note that the default Fargate concurrency limit is 20 Tasks/Services - if you need 100 of them you'll have to raise a Service Limit increase support ticket. </p>
  
  <p>We've got it raised to 200 concurrent tasks because our processing runs 160+ containers in parallel, all on Fargate without a single EC2 to manage. </p>
  
  <h3>Update - how to spin up 100 containers</h3>
  
  <p>I can tell you how <em>we</em> do it with Fargate - in our CI/CD pipeline we build the container image and upload to ECR. Part of the source is also a <em>CloudFormation (CFN) template</em> and in the <em>Deployment</em> stage of the pipeline we create/update CFN stack which creates <strong>ECS TaskDefinition</strong> with all the container parameters. </p>
  
  <p>Then we've got a <em>scheduler</em> job written in Python and triggered by <strong>CloudWatch Event</strong> (cron-like scheduler) that looks up the <em>TaskDefinition ARN</em> and runs 160+ <em>Tasks</em> from that single TaskDef. You can give each Task an extra parameter, or override some config, etc. Or not and just spin it up.</p>
  
  <p>We used to use EC2/ECS and had to do an extra step first - <em>scale out</em> the ECS AutoScaling group to tens of nodes to support our workload and then at the end scale it back in to 0. Other than that it's the same whether you run it on Fargate or on EC2/ECS.</p>
  
  <p>Hope that helps :)</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-09-27T10:05:03.690Z
Answers: I looked at Fargate too, but the nodes are running simulations, so I'm not sure if it's "bad" that I cannot control the instance size of them. But isn't the initial setup of ECS/EC2 vs. ECS/Fargate pretty much the same, other than you don't have to think about EC2's?
Answers: Trolley
Answers: CC BY-SA 4.0
Answers: 2018-09-28T23:46:51.703Z
Answers: @Trolley updated the answer with our method of spinning up the 160+ containers.
Answers: MLu
Answers: CC BY-SA 4.0
Answers: 2018-09-28T23:48:19.960Z
Answers: @Trolley Fargate reserves CPU and Memory for your containers - we didn't observe any degradation in performance on Fargate compared to EC2.
Answers: MLu
Answers: CC BY-SA 4.0
Answers: 2018-09-27T10:02:32.807Z
Answers: 2018-09-28T23:46:13.470Z
Answers: 2018-09-28T23:46:13.470Z
Answers: MLu
Body: <p>I need to do some large scale testing on a system. The system consists of 2 main parts: Manager and Nodes. There will be only one manager server, but 100 nodes. Both the manager and nodes are Docker images.</p>
  
  <p>I want to be able to spin up a setup on AWS, where an instance of a manager, and 100 instances (one instance per server) of the node is started.</p>
  
  <p>What would I use for this? The manager and nodes should be able to communicate together, and the nodes should not be load balanced in any way. So they need a dedicated internal IP that the manager can communicate with.</p>
  
  <p>I've looked at ECS and CloudFormation+EC2 with a custom AMI, but I'm not sure what is the way to go.</p>
  
  <p>Ideally I want a script that I once in a while can run to launch the servers, and close them down easily.</p>
  
  <p>Any suggestions on what I can do on AWS to launch this setup with ease?</p>
  
Tags: <docker><amazon-web-services><amazon-ec2><amazon-ecs><aws-cloudformation>
Title: Best way to launch 100 identical Docker machines on AWS?
UserDisplayName: Trolley
ThreadText: # Best way to launch 100 identical Docker machines on AWS?
  
  (Asked by: username_0 on 2018-09-27)
  
  I need to do some large scale testing on a system. The system consists of 2 main parts: Manager and Nodes. There will be only one manager server, but 100 nodes. Both the manager and nodes are Docker images.
  
  I want to be able to spin up a setup on AWS, where an instance of a manager, and 100 instances (one instance per server) of the node is started.
  
  What would I use for this? The manager and nodes should be able to communicate together, and the nodes should not be load balanced in any way. So they need a dedicated internal IP that the manager can communicate with.
  
  I've looked at ECS and CloudFormation+EC2 with a custom AMI, but I'm not sure what is the way to go.
  
  Ideally I want a script that I once in a while can run to launch the servers, and close them down easily.
  
  Any suggestions on what I can do on AWS to launch this setup with ease?
  
  **Tags:** docker, amazon-web-services, amazon-ec2, amazon-ecs, aws-cloudformation
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-09-27. Score: 5 | Accepted answer
  
  Look at **[AWS Fargate](https://aws.amazon.com/fargate/)** - it lets you run your Docker containers without having to spin up the EC2 instances for an ECS cluster. You simply schedule the Tasks (or Services), each gets is own IP address and they can talk to each other.
  
  You can also use **[AWS Service Discovery](https://aws.amazon.com/blogs/aws/amazon-ecs-service-discovery/)** to facilitate the registration and lookup of the tasks' IP addresses.
  
  BTW Note that the default Fargate concurrency limit is 20 Tasks/Services - if you need 100 of them you'll have to raise a Service Limit increase support ticket.
  
  We've got it raised to 200 concurrent tasks because our processing runs 160+ containers in parallel, all on Fargate without a single EC2 to manage.
  
  ### Update - how to spin up 100 containers
  
  I can tell you how *we* do it with Fargate - in our CI/CD pipeline we build the container image and upload to ECR. Part of the source is also a *CloudFormation (CFN) template* and in the *Deployment* stage of the pipeline we create/update CFN stack which creates **ECS TaskDefinition** with all the container parameters.
  
  Then we've got a *scheduler* job written in Python and triggered by **CloudWatch Event** (cron-like scheduler) that looks up the *TaskDefinition ARN* and runs 160+ *Tasks* from that single TaskDef. You can give each Task an extra parameter, or override some config, etc. Or not and just spin it up.
  
  We used to use EC2/ECS and had to do an extra step first - *scale out* the ECS AutoScaling group to tens of nodes to support our workload and then at the end scale it back in to 0. Other than that it's the same whether you run it on Fargate or on EC2/ECS.
  
  Hope that helps :)
  
  > **Comments:**
  > **username_0**: I looked at Fargate too, but the nodes are running simulations, so I'm not sure if it's "bad" that I cannot control the instance size of them. But isn't the initial setup of ECS/EC2 vs. ECS/Fargate pretty much the same, other than you don't have to think about EC2's?  
  > **username_2**: @username_0 updated the answer with our method of spinning up the 160+ containers.  
  > **username_2**: @username_0 Fargate reserves CPU and Memory for your containers - we didn't observe any degradation in performance on Fargate compared to EC2.  
  
  ---
  
  ### Answer by username_1 on 2019-01-11. Score: 2
  
  Why don't you use [Terraform](https://www.terraform.io/) for the purpose? It can launch as many instances you want, create network for you, create security groups, ECS, IAMs or whatever you want to create and terminate easily when you want. This is widely used in industry now.
  
  
  ---
  
  