temp volume or mounting volume to a running machine?

hi

I would like to understand volumes

  1. is there any temp volume that can be used temporarily. Just when machine runs?
  2. is there a way to add / mount a volume to a running machine?

Those two points came to my mind when I was thinking how to solve the issue I have with disk space / volumes. My machine when requested downloads a pdf file and serves it back. The default volume of 1 GB is good enough for that.

I want to extend my “downloading” service and let the machine download bigger files. Usually it would be around 4 GB. I have not ideal how to solve the issue that I do not want to pay for persistent volume as my machine is 98% of time stopped.

Thank you for any suggestions
Radek

What if you need to expand to 5,6,7, etc GB? It’ll never scale. Use S3/R2 instead with presigned URLs for users to upload/download.

users are not uploading. The machine is downloading and needs temporary space.

Same idea; it’s more cost effective too since R2 has no egress fee. You’ll be paying for fly’s outbound data for each download.

did I understand it right that I can user R2 as a mean to save the downloaded files? I guess I need to mount R2 to do so otherwise the downloading will not work.

I did no find anywhere an example how to mount R2 to my fly machine.

You don’t mount it, it’s a storage service where you use an S3-compat api to get/put objects.

then I do not understand how it can help me. I believe that the file needs to be downloaded first and then put it so external storage.

Are these downloaded files dynamic?

not sure what you mean dynamic. I want to create a service on my fly machine where a user can enter url and then a video on that url will be downloaded via yt-dlp. Then the file will be uploaded to - for example G drive of the user

Eg are they dynamically generated.

Imo that’s a bad architecture. You’re paying for ingress, storage, and egress. That will get expensive fast.

Yt-dlp should have a stream option you can use to write to a bucket to avoid storing it locally. Use Tigris, egress should be free is it’s in same region.

Then use presigned urls to avoid bandwidth to users.

Thank you for trying to help me out.

Why would I need Tigris? Isn’t that a database?

I am looking at yt-dlp although yt-dlp outputs stream so I can save it anywhere I am not sure if it is a good idea. Sometimes yt-dlp would merge what was downloaded into the final file and I guess it would need the downloaded files locally.

Actually users will not get the downloaded file directly. My application will uploaded to their Gdrive, Dropbox, Youtube etc

Came here for a similar reason…

You can attach a volume when you run a machine using the --volume flag, but that volume needs to be created first and it needs to be associated to an app (I think).

You’ll be charged for volumes that you create, whether they are attached to a Machine or not, including when an attached Machine is stopped.

So there’s that… but if you say you need 4 or 5 GB, I’d say the cost is residual… it costs $0.15/GB/month. Alternatively, you could create the volume before launching the machine…

Do you know how to use --volume ?

The question is if we are able to attach volume to a running machine. We can create and destroy volume as we wish via API.