DigitalOcean Spaces: Pros/Cons and how to use it with Javascript

DigitalOcean Spaces: Pros/Cons and how to use it with JavaScript

This article is part of the series: “Cloud Storage Providers, which one to choose?”.

You can check out the rest of the articles here:

  1. Amazon S3: Pros/Cons and how to use it with JavaScript
  2. Google Cloud Storage: Pros/Cons and how to use it with JavaScript
  3. Microsoft Azure Blob Storage: Pros/Cons and how to use it with JavaScript
  4. Backblaze B2: Pros/Cons and how to use it with JavaScript
  5. DigitalOcean Spaces: Pros/Cons and how to use it with Javascript
  6. Wasabi Hot Storage: Pros/Cons and how to use it with JavaScript

DigitalOcean is one of the last providers that decided to offer a Storage service in the Cloud. However, in contrast with traditional companies like Amazon, Google or Microsoft, they chose to use a completely different approach: You pay for packages of resources and not for the amount of space you use. This new way of pricing set them apart pretty quickly. Let’s see if it’s as compelling as it sounds.

Disclaimer: Prices and features change all the time. Please let me know if there are any mistakes :)

Pros

  • Excellent documentation. If you are familiar with DigitalOcean, you probably know that the tutorials in the “Community” section are one of the best in the industry
  • It’s as “developer-friendly” as Amazon S3. It uses an S3-compatible object storage API, meaning that you can use any Amazon S3 SDK with DigitalOcean Spaces!
  • Predictable prices. 5 USD per month for 250 GB of storage and 1TB of outbound transfer each month. Making some calculations, that means 0,020 USD per GB/month, without counting the included outbound transfer. To compare, in AWS you would pay 0,023 USD per GB/month in storage, and 0,09 USD per GB transferred out each month. Meaning that you would have to pay around 90 USD extra just for the 1TB of outbound transfer that it’s included in the DigitalOcean spaces plan each month!
  • Simplicity. Only one storage class. That’s it
  • Easy to use UI. You can drag-and-drop items to upload them to your space
  • Easy to integrate with other DigitalOcean services like Droplets
  • As part of the free layer, new users can try the service two months for free

Cons

  • As far as I know, there’s no paid support in DigitalOcean. This detail might be a bit worrying for big customers who have critical data there and need strict SLAs
  • You spend the same amount of money even if you haven’t uploaded any data. Therefore, if you don’t know how much data you want to store or you intend to use just a fraction of the space at your disposal, maybe DigitalOcean Spaces is not the most convenient option for you
  • They don’t have as many regions as more sophisticated services like AWS, Google Cloud Storage, and Microsoft Azure. Currently, they only offer the following regions: NYC3 (New York), AMS3 (Amsterdam), SGP1 (Singapore)

Nice, but why should I use it over the competition?

  • If you are a developer and already use DigitalOcean for your projects
  • If you have code using the Amazon S3 SDK. You can re-use 99% of it!
  • If you would like simplified pricing and don’t mind much the lack of paid support
  • If you download your data often, then DigitalOcean Spaces is for you. The first TB of outbound data each month is included in the price.

How to use it with JavaScript

As you will see, the only difference between DigitalOcean Spaces and Amazon S3 regarding their use with JavaScript is located in the Authentication code, where we specify a different endpoint.

  1. How to install the library:
npm install aws-sdk

2. How to Authenticate:

https://medium.com/media/17e1a43b16d2c2e5f8a9b3ebcce48aba/href

3. How to create a Bucket:

https://medium.com/media/f79f0af261274d9282746c69937297e6/href

4. How to delete a Bucket:

https://medium.com/media/6c9e69b21d1697c64a23b780fe392fa8/href

5. How to upload a file:

https://medium.com/media/8abecde8a5a31d7975cc9e008b59f9fc/href

6. How to download a file:

https://medium.com/media/36a1d4c4ada15420524a66c372743fd9/href

7. How to delete a file:

https://medium.com/media/922316b8be5aa7838dab5167971fd221/href

8. How to list all files in a Bucket:

https://medium.com/media/85fd84403eca79aedcd9d9892279baff/href

I hope this article is enough to get you up to speed with DigitalOcean Spaces. Let me know if you miss out anything on it!

If you would like to sign up for DigitalOcean and support me at the same time, you can use this link.

Have a nice day!


DigitalOcean Spaces: Pros/Cons and how to use it with Javascript was originally published in DailyJS on Medium, where people are continuing the conversation by highlighting and responding to this story.

You may also like...