Clone Fly Machine using REST call with different CPU/Memory parameters

Three questions regarding spinning up a Fly Machine:

  • What is the route for the Fly Machines API for cloning a machine? If my machine id is 148e42ef77dd89, would it look something like this?
curl -i -X POST \
-H "Authorization: Bearer ${FLY_API_TOKEN}" -H "Content-Type: application/json" \
"http://${FLY_API_HOSTNAME}/v1/apps/fly-machines/machines/148e42ef77dd89/clone" \
-d      '{
        "name": "fly-machines",
        "config": {
                "image": "registry.fly.io/fly-machines:latest"
        }
}'
  • When cloning an existing machine, can I spin up the new machine with different CPU and memory parameters? Guessing I do this via the config JSON

  • When I do fly m run and fly builds an image on my behalf, I don’t have permissions to refer to that docker image when I try using it as the value to my config.image in my JSON config. I don’t want to have to deal with building the docker image myself and pushing it to the fly docker repo; is there a way to let Fly handle building the image, and to reference the image in subsequent machines I spin up?

Clone isn’t a special API call, it’s implemented client side. It’s a combination of GET + POST.

You can reimplement this, just grab the config from the source machine, update the JSON, and create a new machine with it.

Thanks Kurt! I read through the source for the flyctl and figured that out as well.

So far, loving Fly Machines; it’s stupidly fast and I love the amount of control we have over each microVM.

2 Likes