I am developing the architecture of this application and the way we need to scale is not just stateless API requests, but it's a logical split of responsibilities. In other words, we may only be able to work on data 1-5 while we need another instance to work on 6-10. We will need an undefined number of instances and would like a manager to spin up and down EC2 instances as needed.

While scouring the web I am not able to come up with anything good, are there any good articles or is there a term for this? I have found IAC (Infrastrucure as Code) but from what I see that is simply deploying additional services, I don't see anything as IAC spun up from within the application. Is there a term for this?

1 Answer 1


Use AWS API to spin up the instances. There are SDKs (Software Development Kits) for various languages, for example if you're using Python use boto3 library. SDKs for other platforms are also available: Tools to Build on AWS, including the command line tools AWS-CLI for use in shell scripts.

With the SDK of choice you'll simply call something like ec2.start_instance(...) to spin up your new EC2.

However I would question whether you really need standalone EC2 instances for your processing? Perhaps ECS Containers, especially Fargate, or even serverless lambda functions triggered from a work queue may be a better choice?

Hope that helps :)

  • Hey thanks! Well the bottleneck of the application is actually the need for different IP addresses. Unless I can get multiple IP's on a single instance somehow, I haven't seen that either.
    – illcrx
    Jan 6, 2020 at 22:44
  • @illcrx You can certainly have multiple IPs per EC2 network interface (ENI), on some instances up to 50 IPs per ENI and up to 15 network interfaces per instance. That's 750 IPs per instance - it should be enough ;) On smaller instance it's less but even on the smallest you can have 2 ENIs with 4 IPs each. Have a look here: docs.aws.amazon.com/AWSEC2/latest/UserGuide/…
    – MLu
    Jan 6, 2020 at 23:17
  • are those external IPs?
    – illcrx
    Jan 6, 2020 at 23:25
  • @illcrx they are private but you can map a Public IP to each Private IP.
    – MLu
    Jan 6, 2020 at 23:31
  • @illcrx what's the purpose for multiple IPs for one instance? Is it for routing to different containers? Not sure your use case but maybe you can use a load balancer / reverse proxy to route request based on http requests.
    – Yan
    Jan 7, 2020 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.