Are you confused about which object storage provider to choose for your next project?
In this review, we will take a look at DigitalOcean Spaces. By the time you finish reading it, you will be able to decide if it is right for you or not. Also, I am sharing my experiences after using Spaces for more than six months.
You might know that Amazon S3 & Google Cloud Storage are two mammoths in this field. We will check how Spaces competes against these competitors, and what makes it different from such enterprise-grade storage providers.
You might want to check:
By the way, if you want a quick primer about what is object storage and when to use it, read the next section. Otherwise, you can skip to the pricing.
Why Use Object Storage?
As a blogger who manages a couple of image-heavy sites, I felt that storing all these assets on the same server as my website resides is not a great idea. These were the top reasons to try offloading:
- Migrating web hosts was a pain.
- Traditional storage is not so scalable. Most web hosts impose a maximum file limit (Inode), crossing it can lead to account suspension.
- I needed a better place to store site backups.
That’s why I decided to offload static assets to an object storage solution. Now, the images you see on this blog are stored on a cloud block storage and served via BunnyCDN.
Update: After I offloaded images, some WordPress plugins (especially image optimization plugins) didn’t work properly. So, later I switched back to normal. But still, object storage is a great choice for storing backups and archiving purposes.
So, what is meant by object storage?
Here it is. Traditional storage system like the hard-drive on your PC uses a file system to store data. For example, Windows OS uses the NTFS system. These systems use a hierarchical structure to store the details about files and folders. This can limit the potential to scale up.
In contrast to this, Object storage treats every data as an object with an identification key. There is no hierarchy or folder. It doesn’t follow file systems. So it can scale indefinitely and will not slow down. Read this article to know more about the differences between Object storage and file-based block system storage.
Object Storage does not have a file system or hierarchy.
That brings us to the following advantages of object storage:
- Easy to Scale, does not slow down.
- Can be accessed via API.
- No file system, so any number of metadata can be attached to a data object.
- Object storage services are relatively more secure.
Let us see some of the best use cases of an object storage system like Spaces:
- Serve website assets like images, CSS, etc.
- Store backups and archives
- Store images, photos, videos, and similar files that are static in nature.
As you can see, it is best for static assets that do not require editing. On the other hand, files (data) like databases that require editing are not suited for object storage. You can only access and upload a whole object at once and cannot modify a part of it.
Storing databases on an object storage may not be a good idea.
Pricing – What makes Spaces Different from Amazon S3?
A simple pricing model is the main reason you might want to consider DigitalOcean Spaces instead of others. Starting at $5 per month, Spaces gives you 250GB of storage and 1TB of outbound transfer bandwidth.
These are the key things that make Spaces different:
- Predictable monthly pricing for fixed resources instead of pay-per-use
- Lower cost per GB – $0.02/GB/month storage or $0.005/GB/month bandwidth
- No additional charge for requests like GET, PUT, POST, etc.
- No charge for inbound transfers.
In contrast, Amazon S3 prices start at $0.09/GB/month for outbound transfer bandwidth and $0.023/GB/month for storage. So, that is a total of $0.113 per GB per month. Remember, we haven’t included the price for requests.
Let us do a quick comparison:
|Item||Usage||Spaces Price||S3 Price|
|Storage||250GB||$5 @ $0.02/GB||$5.75 @ $0.02/GB|
|Monthly Bandwidth||1000GB||Included||$90 @ $0.09/GB|
|GET requests||5000K*||Included||$2 @ $0.0004/1000 req.|
*Assuming that we receive a total of 500k page views monthly @ 10 requests per page.
In the DigitalOcean ecosystem, a Spaces subscription is equivalent to a bucket in S3. Just like buckets, you can create multiple Spaces within your account. In short, the terms Space and Bucket can be used interchangeably.
Also, note that there is no limit on the number of Spaces (buckets) you can create with this price. That means, the 250GB storage and 1TB bandwidth limits are for all the Spaces you have created. The monthly bill with still be $5 if your overall usage is below these limits [see this forum thread].
Although cheaper, Spaces is not behind when it comes to features. With the recent addition of CNAME sub-domain support for CDN, it has become more capable than before.
Compatibility with S3
If you are an existing S3 user, moving your applications’ assets to Spaces won’t be a problem as it is completely compatible with the AWS S3 API.
You can also use existing packages and tools like S3Cmd and AWS S3 SDK.
So, if you are a developer, you can start integrating Spaces without learning another SDK documentation.
After generating an access key and a secret key from your DigitalOcean dashboard, you can programmatically connect with your Spaces to create and delete buckets, and manage your data objects.
SDKs are available for all major programming languages like PHP, Node, Go etc.
API tools for non-developers & non-coders
So far, we have discussed these things from a developer’s standpoint. But don’t worry if you don’t know how to code. There are several free and freemium tools out there to help you.
- WP Offload Media by Delicious Brains – This is one of the popular plugins available today to move your files to cloud object storage. The plugin also has a free lite version.
- Media Library Folders Pro – Another WordPress plugin to move your media files from your web host to Spaces or S3.
- FileZilla Pro – The premium version of the FileZilla FTP program comes with the ability to connect with DigitalOcean Spaces.
Note: I do not have much experience with these three tools. Instead, I’ve created a custom plugin to integrate my own sites with Spaces. It was quite easy to integrate the API, which is a topic for another post.
Drag & Drop Upload
Apart from the API access, DigitalOcean’s cloud dashboard allows you to manage the files on your spaces from a simple drag and drop interface.
Earlier, we have seen that object storage does not follow the concept of traditional files and folders. However, GUIs can present them in such a fashion based on the objects’ key name. For example, if you have an object photos/profile.jpg, GUIs can show it as a file named profile.jpg inside the folder photos to make it is familiar and easier to manage.
Multiple Datacenter Choices
Spaces currently offers four data center locations:
- San Francisco
- New York
In contrast, Amazon and Google Cloud offers more locations to choose from.
All the assets stored on your spaces can be accessed using the secure HTTPS protocol.
You can also set the privacy of individual files as public or private. Public files can be viewed by anyone using its URL while only you can see the private files.
In-built Content Delivery Network (CDN)
When you subscribe to Spaces storage, you also get a CDN without incurring further costs. That means you can serve your assets either from the origin or from an edge location closer to your users. The latter helps to reduce network latency.
- Enable CDN from the dashboard
- add the name cdn to the URL of assets: For example, https://spacename.sfo2.digitaloceanspaces.com/photo.jpg retrieves the asset from the origin server while
https://spacename.sfo2.cdn.digitaloceanspaces.com/photo.jpg retrieves the asset from the nearest edge server.
Currently, they have 25+ PoPs (Point of Presence) spread across five continents.
Supports CNAME Subdomain for CDN
Custom sub-domain for CDN has been a long-awaited feature. Finally, on April 9, 2019, DigitalOcean announced on their blog the ability to attach your own domains to the built-in CDN assets.
With this, you can serve assets from a URL like https://cdn.yoursite.com/photo.jpg instead of the lengthy https://spacename.sfo2.cdn.digitaloceanspaces.com/photo.jpg.
How to Use
After signing up for a DigitalOcean account, start by creating your first project, if you haven’t already done it.
Creating Bucket & Uploading
Clicking the Create button on the bottom reveals a drop-down menu. From it, select Spaces.
On the next page you have to set the following things:
- Datacenter location
- CDN (optional)
- Directory listing – enable or disable
- Bucket name
- Project name
Finally, click Create to deploy your new bucket.
You can access the newly created bucket by clicking the Spaces on the left sidebar. Drag and drop the files you would like to upload.
Don’t forget to set the permission to public for publicly viewable assets.
Once the file is uploaded, you can view it in the dashboard along with its addresses, preview, permission, and mime-type.
Generating API Keys
If you are just trying out Spaces or using it for storing personal files, then drag-and-drop upload may be sufficient. On the other hand, if you mean to use it for more complex things like website integration, then API is the way to go.
To use the API, you have to generate an access key and a secret key. You can do that from the API section of the cloud dashboard. On that page, click Generate New Key.
Once the keys are generated, remember to copy and paste it into a safe location.
Later, you can use these keys to connect to your bucket using one of the tools I’ve mentioned earlier.
After running a few ping tests using KeyCDN’s free tools, the global average latency I got for my bucket in the San Francisco region was 124ms for the origin URL. The tool pinged three times from fourteen locations around the globe.
Next, I checked the same using the CDN URL. Then the average time reduced to a mere 14.5ms. Out of the fourteen locations, Sydney (Australia) recorded 113ms and Bangalore (India) clocked 39ms. All the other locations responded under 20ms.
|Min1||Min2||Max1||Max2||Avg (all locs.)|
|Origin Server||1.17ms |
|Edge Server||0.24ms |
So, if you serve assets for the web from Spaces, enabling CDN can improve performance almost ten times. If you use another CDN service, then it is better to disable the in-built CDN as it can cause network confusions.
DigitalOcean offers support through tickets and through forums. I had tried the ticket system, and the wait times can be a bit long at times. Otherwise, their services have been great so far and the resources are also well detailed.
Pros & Cons
- Simple & predictable pricing structure
- Compatible with S3 API and other existing tools
- Less no. of regions than S3 & Google
- Some advanced features like Object policies and Bucket Replication not supported. Bucket Policies are supported though, via the API.
We have seen how object storage works and why DigitalOcean Spaces can be an affordable choice.
Because of its predictable pricing, Spaces gives greate peace of mind than its competitors like S3 and Google Cloud. So, for beginner users and bloggers who do not have much experience with cloud object storage, Spaces gives an easy entry. It has the potential to serve enterprise users as well.
Since it works much like S3, developers also find it easy to work with. So, again it is a great option if you already use DigitalOcean’s other products like droplets.
On the other hand, if you need more regions then Amazon and Google offer that along with a lot of other services.
Then we saw how the performance improved when coupled with the built-in CDN. Now it supports custom sub-domains also.
Have you used Spaces? What is your experience, and how do you feel it against S3 or GCP? Mention it in the comments.