Launch VS Code

Visual Studio Code (VSCode) is an alternative to Jupyter Notebooks that is used for software development, including data science and machine learning tasks. Truefoundry enables you to run VSCode on Kubernetes on any hardware you need, and auto-shut down when it's not being used hence saving costs.

To get started with launching VSCode, you can follow the steps outlined below (You can find details on the configuration options below)

The VS Code Instance will go live in a few minutes. It takes a few minutes since the image will need to be downloaded on the machine first. Once the VS Code Instance becomes live, you will see the status turn to Running and an endpoint will start showing up. Clicking on the endpoint will take you to the VS Code Instance.

Stop and Resume your VS Code instance

When you're done working with a VS Code instance, you can stop it to conserve resources and reduce costs. Clicking on the Stop button shuts down the VS Code instance environment and releases associated resources.

Your VS Code instance data (apart from the apt packages installed as a root user) persists, and you can easily restart it later by clicking the Resume button.

Configure your VS Code Instance

In the VS Code instance creation form, you can configure the following options:

Install Apt packages in the Vs Code instance

Imagine you're working on a computer vision project and need to do video manipulation using the ffmpeg package to process your videos. Given ffmpeg is an apt package, you will have to install it using sudo apt install ffmpeg. However, the default VS Code instance container doesn't have root access, which will prevent you from installing this package.

In this case, you will require root access in the VS Code instance to install your system-level dependencies. You can enable root access by ticking on the Enable root access to the container checkbox:

This will grant you sudo access within the VS Code instance container. And now you will be able to run the sudo apt install ffmpeg command.

It is important to note that, any apt packages installed as root users will not be persisted across VS Code instance restarts. Any installed packages will be removed when the VS Code instance is restarted and will require reinstallation.

So if you restart your VS Code and then run any ffmpeg command, it will show command not found

You will have to reinstall ffmpeg to use it.

To avoid reinstalling every apt package again and again, once you have figured out the apt packages you require for your project use the temporary Enable root access solution, you can define the apt packages to be installed while creating/editing the VS Code instance. This will ensure that the apt packages remain available even after the VS Code instance restarts.

You can do so by following these steps:

Storage Size

Specify the amount of storage space you require for your VS Code instance. This is persistent storage that will be used to store your files, data, and any other artifacts generated during your work.


Choose the endpoint to which your VS Code instance will be deployed. This endpoint will determine the URL at which your VS Code will be accessible.

Set resources for your VS Code

Define the computational resources allocated to your VS Code instance. You can adjust the CPU and memory allocation to meet the requirements of your data science tasks.

Running a VS Code instance with GPU

In case you want to use GPU in your VS Code Instance, you can follow these steps:

Upon successful deployment, your GPU VS Code instance instance will be provisioned with the specified GPU type. You can then utilize the GPU resources to accelerate your computations, such as training deep learning models or running GPU-intensive workloads.

Login Credentials

Imagine a scenario where someone outside your team stumbles upon the VS Code Instance's Endpoint. This could potentially grant them access to sensitive data or allow them to tamper with the code. Login credentials are essential in safeguarding the VS Code instance from unauthorized access. Even if an unauthorized user acquires the endpoint URL, they'll be unable to access the VS Code instance without proper authorization.

Specify the credentials for accessing your VS Code instance. This includes the username and password for logging into the VS Code environment.

Access data from S3 or other clouds

In some instances, your VS Code instance may need to access data stored in S3 or other cloud storage platforms. To facilitate this access, you can employ one of two approaches:

Credential-Based Access through environment variables

This approach involves defining specific environment variables that contain the necessary credentials for accessing the cloud storage platform. For instance, to access S3, you would set environment variables for the AWS access key ID and secret access key, the environment variables being: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY

IAM Role-Based Access through Service Account

The second approach is to provide your VS Code with a Role with the necessary permission through Service Accounts.

Service Accounts provide a streamlined approach to managing access without the need for tokens or complex authentication methods. This approach involves creating a Principal IAM Role within your cloud platform, granting it the necessary permissions for your project's requirements. Here are detailed guides for creating Principal IAM Roles in your respective cloud platforms and integrating them as Service Accounts within the workspace:

Once you've configured the Service Account within the workspace, you can simply toggle the Show Advanced Fields option at the bottom of the form. This will reveal an expanded set of options, from which you can select the desired Service Account using the provided dropdown menu.

Access data in volume from the VS Code Instance

Mounting a volume to a VS Code instance allows you to access data stored on the volume from within the VS Code environment. This can be useful for a variety of tasks, such as loading data for analysis, training machine learning models, and deploying applications.

You can follow these steps for mounting a volume to the VS Code instance:

Once mounted, in your VS Code instance you will be able to access the data in your Volume from within the VS Code instance.