Fly API access

Hi there!

I’m evaluating fly for a project, and one of my requirements is being able to programmatically interact with an infrastructure API to spin up/down (stateful) application instances on demand. I’ve done some validation of the service itself running on fly using flyctl which worked great. Now I’m looking for more information on how I can translate some of those flyctl actions into API calls that can be made by a service.

Generally, I’m also looking for some pointers on whether or not this is a bad idea :slight_smile:

My use case is to host a fly app “per customer” for resource isolation and different constraints (some customers will want to pay for and use more memory/cpu), using a pre-built docker image I (the service provider) will maintain.

So it’d look something like customer signs up → provisions an instance of my service → fly app is created → they can interact with their running service hosted on fly (they need not know it’s on fly)-> my service handles the lifecycling of the fly app by making API calls to fly (if possible) to scale/delete/pull logs/etc

Would this be a viable use of the fly platform? Is there a documented API somewhere I’ve missed that could be used to do so?

Thanks so much,
Patrick

1 Like

This isn’t a bad idea at all, several other customers are doing it too. We haven’t put much energy into documenting the api or making it friendly to use, but it’ll get the job done and is always improving. It’s a GraphQL api with a playground you can explore at GraphQL Playground.

Flyctl uses it, so checkout the go code for a reference.

Also, you’ll likely want to isolate customer apps by putting them on different networks, otherwise they can connect to each other. We’ll be improving support for this in the coming weeks.

2 Likes