Digital Ocean logo

DigitalOcean Spaces offers Amazon S3 compatible object storage for a low cost and with a built-in CDN. Especially if you use the DigitalOcean services, Spaces offers a great way to store backup files (when used as a private repository) or even to host a static site using the CDN capabilities.

  • $5 per month
  • 250 GB of storage space
  • 1 TB of outbound transfer
  • Unlimited uploads
  • Creation of unlimited number of spaces

In this article, we are going to explore how to get started with DigitalOcean Spaces and some common operations that would be used.

Creating a Space

Once you have signed into DigitalOcean and chosen to create a new Space, you will be presented with the options to provision your Space. You will need to determine the following:

  • Datacenter Region
  • Whether to Enable CDN or not
  • Allow or Restrict File Listing
  • Decide on a Name for the Space

File listing does not determine whether or not an anonymous user can view a file, only whether they would be able to list the name, size, and additional metadata for files stored in the Space.

In this example, we are choosing to create the space in Datacenter Region 2, San Francisco, enable the CDN (without a custom subdomain), and restrict the anonymous file listing.


Finally, we will choose a unique name, lc-articles in this case, and whether to place it into a project. Next we will click on the Create a Space button to provision our Space.

With out newly created Space, you will see that there are no files but through the interface, we can easily upload files or create folders as necessary.

Clicking on Settings shows all the configurations that we can modify. Several additional features here are very useful. Notably the Purge Cache option and the CORS configurations.

Generate Spaces Access Keys

Navigate to the Account → API section and under the Tokens/Keys section find the Generate New Key option for Spaces access keys.

Enter a name to identify the access key. Once saved, you will be presented with the key and the associated secret.

Make sure to copy the Secret value out, as once this is hidden, by navigating away from the page or performing another operation you will not be able to get back to this secret value.


We will use these two values to connect to the DigitalOcean Space that we created.

Configure S3Cmd

In this article we are going to use the popular S3Cmd tool to upload files from an Ubuntu server. After installing S3Cmd, which can be done in Ubuntu using apt install s3cmd, we will need to create a configuration file. The easiest way to get started is to use the s3cmd --configure command. There are a number of different settings that we need to configure.

  • Access Key – The same access key as created on the API token page.
  • Secret Key – The same secret key as created on the API token page.
  • Default Region – Left as the default US in this example.
  • S3 Endpoint – This will be the same endpoint as shown on the settings page for the Space.
  • DNS Based Bucket Syntax – Instead of the default value, this should reflect the correct endpoint: %(bucket)s.{region} Replace {region} with the correct value as shown on the settings page.
  • Encryption Password – Left as blank in this example.
  • GPG Program Path – Left to use the default GPG program path.
  • HTTPS Protocol – Left to use the default of using the HTTPS protocol.
  • Proxy – Left as the default of no proxy connection.

It is also wise to use the test connection option to make sure the settings are correct before saving the configuration file.

We can verify that this works by simply running the command s3cmd ls. If we see the output of our newly created Space (bucket in S3 parlance), then we know that the connection is working.

Uploading Files

The first operation that we are going to demonstrate is that of uploading a files or files to our Space. The command to upload a file is very simple:

s3cmd put filename s3://DigitalOcean-Space-Name

As you can see from the above screenshot, the file has been successfully uploaded. Additionally, you can verify this in the GUI as well.


Listing Files

How can we list what available files are currently located in the Space? Much like the standard Linux command of ls, we use a similar one with S3Cmd.

s3cmd ls s3://DigitalOcean-Space-Name

To retrieve additional information about a given file in the Space., we can use the info command to list the metadata associated with the item.

s3cmd info s3://DigitalOcean-Space-Name/filename

Removing Files

Removing files is just as easy as the prior operations. Now that we have uploaded our file, been able to list that file, we can use the path returned to allow us to delete the file.

s3cmd del s3://DigitalOcean-Space-Name/filename

As you can see, we have deleted the [](<>) and verified, via the command line, that the file is no longer listed within the Space. Furthermore, if we check the GUI, we can see that the file has also been shown as removed.


DigitalOcean Spaces offers a compelling mix of low-cost functionality that will fit many of the needs of a system administrator looking to make use of a low-cost storage location. Since DigitalOcean is generally geared towards rapid development and robust production services, having the ability to quickly store large files, accessible to multiple servers, is a convenient and often used ability.

One of the most popular use cases is that of storing system backups here. If you use a traditional method of backing up, such as creating a TAR or ZIP file, then you can easily transfer those files in a script to a DigitalOcean Space. Check out how quick it and easy it is to get started on the DigitalOcean site!

Profile Photo for Adam Bertram Adam Bertram
Adam Bertram is a 20+ year veteran of IT and an experienced online business professional. He’s a consultant, Microsoft MVP, blogger, trainer, published author and content marketer for multiple technology companies.
Read Full Bio »