Skip to main content

File Operations

Upload input files to a sandbox, generate output files inside the VM, and download results.

Upload a file

# Upload via volume files
instavm volume files upload <volume_id> ./data.csv --path data.csv

# Or via SCP after creating a VM
instavm create
scp -P <port> ./data.csv user@<host>:/app/data.csv

Download a file

# Download via SCP
instavm connect <vm_id>
# Inside VM: generate the file, then exit
scp -P <port> user@<host>:/app/output.csv ./output.csv

# Or via volume files (if using volumes)
instavm volume files download <volume_id> output.csv --out ./output.csv

Generate and download an image

# Generate in VM, then download via SCP
instavm create
instavm connect <vm_id>
# Inside VM: pip install matplotlib && python3 plot_script.py
scp -P <port> user@<host>:/app/plot.png ./plot.png

Get file content without saving

result = vm.download_file('/app/output.txt')
print(result['content'])

Process uploaded files

Upload a file, process it in the sandbox, download the result:

# Upload, process via SSH, then download
instavm create
scp -P <port> ./input.txt user@<host>:/app/input.txt
instavm connect <vm_id>
# Inside VM: python3 process.py
scp -P <port> user@<host>:/app/output.txt ./output.txt

File paths in the sandbox

PathDescription
/appDefault working directory, use this for your files
/tmpTemporary files
/rootHome directory

Binary files

The upload/download methods handle binary files (images, PDFs, videos) without any special configuration. The content is transferred as-is.

Next steps