Search code examples
digital-oceanscp

How to copy / transer files from ubuntu terminal into a digital-ocean space


Can I scp files to digital ocean space from ubuntu terminal?

I setup a space in my digital ocean account, I can drag and drop files into the space, but I cant figure it out the way that I can copy files to the space from the command line.

Do I have to use droplets, but its a additional server right? I dont want a server. I just want a space to store some files.


Solution

  • There is a tool called s3cmd which used to upload files and folders to s3 buckets in amazon. You can use this for the same purpose. But for digitalocean you will need an updated version of s3cmd (version 2 or above)

    There is a digitalocean documentation about setting up s3cmd you can check it out from here as well

    I got s3cmd latest python tarball

    wget https://sourceforge.net/projects/s3tools/files/s3cmd/2.0.1/s3cmd-2.0.1.tar.gz

    extract it

    tar xzf s3cmd-2.0.1.tar.gz

    Now install it using below command with source files.

    cd s3cmd-2.0.1

    sudo python setup.py install

    Now you will need to obtain the access token and the secret key from digital ocean api You can find the procedure here

    after getting the token and the key run

    s3cmd --configure

    provide your region, and the bucket url, etc. then after the configuration

    simply run

    s3cmd ls to find out the bucket url

    then you can upload files by running

    s3cmd put file.txt BUCKETURL

    if you want to upload directories

    s3cmd put -r folderName bucketname