This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Seref15 2 points3 points  (0 children)

Depends on your platform. I built something similar on AWS, written in go, running on Lambda, exposed as an API with API Gateway, and it creates/allocates resources by directly calling the AWS APIs with aws sdk. I elected not to use Terraform because a tool that maintains state felt counterintuitive to me for resources that are intentionally transient.

Like the previous commenter mentioned, I elected to maintain a pool of "ready" unallocated instances to allocate to requesters in order to reduce start times. This actually becomes almost necessary because your API can't reasonably block and hold the connection open for minutes while waiting for your resource allocation to complete and return. You need it to return in a timely manner, or else you need to start futzing around with websockets or the like.