Ah ok, there are many options here. You essentially need to do some programmatic devops. You can do this with Kubernetes, Terraform, or the cloud provider APIs directly. You'll need to maintain parity between what they want running and what is running, quotas / limits so they don't run up your bill, and cleanup of resources.
You'll want to be cautious of, and thoughtful in, your security because you are allowing users to run untrusted code. It's not just about protecting yourself from them, but also protecting users from each other.