Spaces is a simple and easy-to-use cloud storage solution from DigitalOcean. Simplicity has always been the reason why developers loved their products like Droplets. That trend continues with Spaces also.
In this review, let us look at why DigitalOcean Spaces can be the choice for your storage needs, and how it compares with other leading object storage providers like Amazon S3.
Why Use Object Storage?
As a website owner and 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 good idea. So I started considering 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.
If you are wondering what is meant by object storage, here it is. Traditional storage system like the one 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 system storage.
Object Storage does not have a file system or hierarchy
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.
Pricing – What makes Spaces Different?
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.
So, when you utilize the full resources, Spaces can be up to twenty times less costly than S3 for similar usage. Otherwise, if your bandwidth usage is too less, S3’s pay-per-use is more cost-effective because Spaces charges the minimum $5 per bucket even if you don’t use it.
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.
In DO ecosystem, a Space 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.
Compatibility with S3
DigitalOcean has designed Spaces with the existing S3 users and developers in mind. That’s why it is almost completely compatible with the existing packages and tools like S3Cmd and AWS S3 SDK. If you are a developer, you don’t need to learn one more SDK documentation to integrate your website or application with Spaces.
Start by creating an access key and secret key from your DigitalOcean dashboard. After that, you can programmatically connect with your Spaces to create and delete buckets and manage your 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 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 FileZilla FTP program comes with the ability to connect with DigitalOcean Spaces.
Note that I created a custom plugin to integrate my own sites with Spaces. That is a topic in itself which I plan to write in a future post. So, I do not have much experience with the tools mentioned above to give a detailed opinion.
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 Choies
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 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 to DigitalOcean, 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 we 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.)|
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.
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.
Finally, DigitalOcean gives $100 credit for 60 days for new users. Sign-up with the following link to get it.