We're launching Fly machines today

Expect a blog post real-soon-now. :tm:

Fly Machines are VMs with a fast REST API that can start up a new instance in about 300ms.

Our proxy can start Fly Machines for you, and you can shut them down when they’re idle. Which means you can cost-effectively create pools of VMs and keep them standing by ready to handle new requests.

If you’re already running an app on Fly.io, here’s what you need to know. Machines are basically the same as the VMs we manage with our orchestration system (Nomad). When you deploy an app, we create new VMs and destroy the old ones with your preferred image. Fly Machines are one level lower, and let developers manage individual VMs.

We built Machines for us. Our customers want their apps to scale-to-zero, mostly to save money. Also because it feels right. An app that isn’t doing anything shouldn’t be running.

Fly Machines might be useful to you, too. A lot of y’all want to build your own functions-as-a-service. You can build a FaaS with Fly Machines.

Blog link that currently 404s (don’t click it, nothing there): https://fly.io/blog/fly-machines

16 Likes

Niice. Too low-level, but all-powerful at the same time.

Attaching volumes to machines is coming, like, really soon! (ref)

A straight-up winner! This feature, when?

“Don’t click it” → 8 clicks. :rofl:

1 Like

It works now :rocket:

Do click it!

5 Likes

It works now but it’s not documented yet. Check out the flyctl source if you want it now, or wait for docs in the coming days!

1 Like

I’m trying fly machine by just looking at fly m --help. It looks like I must have a docker image on a public repository as the command to run fly machine is flyctl machine run <image> [command] [flags]. There’s also the --dockerfile option. So I wonder if it’s (or, will it be, in the future) possible to deploy a fly machine from just a Dockerfile (similar to an app.)

The dockerfile option should work as expected.

But you can still run your own builds and push to the Fly registry, where your builds are only visible to you and our servers. To do that, you’d need to create an app, then fly auth docker, and finally, push to registry.fly.io/your-app-name:some-tag. Using this image with fly machine run works.

3 Likes

Hi, as mentioned in the article “fly deploy” is not available. Does it mean that the deployment isn’t rolled out in Blue/Green fashion? How does it behave? You also mentioned a fixed cost of $0.15/mo for a 1GB Docker image. This is costly for object storage. It kills a bit the idea of designing a FaaS with Fly.io Machines. Imagine, you’re running 10K functions. You would have idle costs of around $1500. I understand that maintaining a state isn’t for free but it should be billed per usage.

Could you tell me more about how a dockerfile can be built remotely and do we profit from a build cache?

2 Likes

10K functions, all 1G in size? Compiled languages like C/PP, Golang, D, and Rust can be bundled in tiny distroless / alpine runc images (10M+). That’s 10K instantly launchable functions for $15/mo.

One could also terminate destroy machines to rid of unused functions, than keep them around, to optimise for costs further. This will, though, increase machine start time, when a request to the now terminated destroyed function does need to be served. Tricky.

Though, I agree Fly needs to rethink its pricing as it doesn’t “scale” for large customers with a lot of idling functions.

1 Like

I think you have never worked with NPM :grin: 1GB is the worst case but 300-700MB are pretty common. We can not ensure that customers have their images optimized to the last bit.

2 Likes

Well true, npm can result in absurd sizes but you can get rid of much of it. Like by using nm-prune - npm before a deploy. If you were to provide it to customers you could specify a sensible yet still generous max size. Cloudflare and AWS do, so it’s entirely reasonable.

1 Like

I somehow did not know about the internal docker registry until today :smiley: . Thank You!

I managed to launch a Fly Machine!

The --config flag does not seem to work for me though. Following is what I am doing.

#fly.toml
app = "cranky-app-9423"

[env]
  FOO=BAR
  YING=YANG

fly machine run --config fly.toml registry.fly.io/cranky-app-9423

Any ideas? No errors as well.

% fly version
fly v0.0.328 darwin/amd64 Commit: be3bfa2 BuildDate: 2022-05-18T15:02:10Z
1 Like

That’s fair. When are images deleted? How much would it cost to deploy ten revisions per month with an average image size of 100MB? Will it still cost me $0.15, or how many images are kept warm?

Ah, so the config flag is misleading. It doesn’t actually work here. Machine config may only be done through the available command line arguments, or via the API.

Good question. Yep, the key to the cost is if/when they are auto-deleted.

That’s one for Fly.

Wait, why won’t flyctl m run --config <fly.toml> ... work when it is documented as a valid cli arg? Or, you mean to say that in this instance it should be flyctl m start --config <fly.toml> ... instead?

It looks like that option was added prematurely. It doesn’t actually do anything, so should be removed. I’ll file an issue.

UPDATE: The -c option was removed in the latest release of flyctl.

1 Like

You’re actually only paying for machines that you’ve created and left stopped. That’s “warm” right now. You can totally just destroy machines and create new ones when you need to, which will pull the Docker image from our registry and boot the thing up.

1 Like

The docs mention that machines can sleep on their own but is this documented anywhere?

Do the machines themselves have to call the API or are they put to sleep after some time of inactivity?

This is very exciting functionality - I finally got around to signing up to Fly (which I’d intended to do for a while) to try it out.

It works great for sizes up to shared-cpu-8x, but when I attempt to use any dedicated CPU option (e.g. dedicated-cpu-1x) I get this:

Error could not launch machine: insufficient CPUs available to fulfill request

Is this perhaps a restriction on my new account? Or a temporary limitation of the new service? I tried in syd, sin and iad regions. EDIT: I just tried depositing $25 in my account and that doesn’t seem to have changed it.