Configuring DVC with Object Storage
Git is unarguably the most popular and powerful version control system to store your code and can handle files of up to 5 GB thanks to Git LFS.
However, when it comes to large datasets, you might need to turn to third-party version control tools that are specifically designed to handle them.
Data Version Control (DVC) was specifically designed with this use case in mind. It works alongside Git and allows you to store your data in the remote storage of your choice (such as a Scaleway Object Storage bucket) while storing only the metadata in a Git repository.
In this tutorial, you learn how to use Scaleway Object Storage (External link) as a remote storage for DVC.
Before you start
To complete the following actions, you must have:
- A Scaleway account logged into the console (External link)
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- A valid API key
- An Object Storage bucket
- A repository to store your metadata
- Made your first request with Scaleway API (External link)
- Authenticated to the API (External link) for the first time
- Installed the AWS CLI
Setting up DVC
-
Run the following command to install the DVC Python package:
Copypip3 install dvc -
Run the following command to install the Amazon S3 dependencies:
Copypip3 install "dvc[s3]" -
Run the following command in the desired repository to initialize DVC:
Copydvc init -
Run the following command to commit the initial DVC configuration files:
Copygit commit -m "Initialize DVC"
Retrieving and tracking data
-
Run the following command to copy the example data file to your repository:
Copydvc get https://github.com/iterative/dataset-registry \ get-started/data.xml -o data/data.xml -
Run the following command to stage the files you want to store in your bucket:
Copydvc add data/data.xml -
Run the following command to track the DVC metadata file and
.gitignorefile with git:Copygit add data/data.xml.dvc data/.gitignore -
Run the following command to commit the metadata file:
Copygit commit -m "Add raw data" -
Run the following command to push your changes to your Git repository:
Copygit push
Pushing data to Scaleway Object Storage
-
Run the following command to add your bucket as remote storage for your data:
Copydvc remote add -d myremote s3://my-bucket/path -
Run the following command to set the Object Storage endpoint of your remote storage:
Copydvc remote modify myremote \ endpointurl https://s3.fr-par.scw.cloud -
Run the following command to push your data to your bucket:
Copydvc push -
Run the following command to list the content of your bucket:
Copyaws s3api list-objects-v2 --bucket my-bucketThe content of the bucket is displayed:
Copy{ "Contents": [ { "Key": "22/a1a2931c8370d3aeedd7183606fd7f", "LastModified": "2023-05-30T14:49:26.000Z", "ETag": "\"22a1a2931c8370d3aeedd7183606fd7f\"", "Size": 14445097, "StorageClass": "STANDARD" } ] }
Going further
- Refer to the official DVC documentation (External link) for more information on configuration and use cases.
- Refer to the official Git documentation (External link) for more information and tutorials on version control.
Visit our Help Center and find the answers to your most frequent questions.
Visit Help Center