Site icon Filestack Blog

Taking Advantage of Different Cloud Storage Options

A representation of cloud storage

Cloud computing has allowed business to completely revolutionize how they manage their computing and storage resources, changing how they handle their IT and infrastructure costs.   The big three vendors at this point for cloud storage are Amazon Web Services (AWS), Microsoft with its Azure platform and of course Google with Google Cloud Services (GCS).

Each cloud storage platform has its pros and cons.  AWS has a huge array of services but is costly.  Azure integrates tightly with Windows, Office and other Microsoft software but its enterprise readiness is not necessarily in line with customer expectations, and in some cases its management requires more manual interaction than some shops would prefer (as opposed to automation-type approaches). While Google is leading in the development of standards that the other platforms have adopted (such as Kubernetes for cluster management), they are less feature rich and tend not to be a strategic partner for their customers.  

Evaluating Cloud Storage Options

For cloud storage in particular, both AWS and Azure offers a laundry list of use case specific and sometimes innovative services that can be accessed through common API patterns such as REST.  Google’s offerings are once again more limited, but they have equivalent services for the most common needs an enterprise would have.

For a more detailed comparison of these services see: https://www.datamation.com/cloud-computing/aws-vs.-azure-vs.-google-cloud-comparison.html

Ready to get started?

Create an account now!

Overall, it can be case specific what an enterprise will choose for the purpose of cloud computing — and those needs can change over time or as opportunities for partnerships develop with one or the other vendor.  The needs could even vary from project to project within an enterprise.  

Therefore it is important that the tools and the code base a software development group use or create to manage where they are storing their files can be relatively agnostic.  In that way any switching between platforms won’t lead to prohibitive or unexpected additional development or QA costs.  Even developing and maintaining one’s own API “wrapper” is a cost point that most shops would rather not have to incur themselves.

This is where Filestack comes into play.   In addition offering a wide variety of services for manipulating images and video, Filestack can act as that platform agnostic wrapper through which your code interacts with a given cloud storage option.   

Storage Options with Filestack

Once your API Key is configured to work with a given storage option, the source code to move files to one or the other cloud storage is very similar, allowing the client code to be written in such a way that no specific code path needs to be taken when actually dealing with uploading files.  

Below are code examples for storing to S3, Azure and GCS once the file picker has been instantiated:

Storing to S3 with the file picker

client.pick({
  storeTo: {
    location: 's3',
    path: '/myfiles/1234.png',
    container: 'my-files',
    region: 'us-east-1',
    access: 'public'
  }
}).then(result => {
  console.log(JSON.stringify(result.filesUploaded))
})

Storing to Azure with the file picker

client.pick({
  storeTo: {
    location: 'azure',
    container: 'user-photos',
    path: '/myfiles/1234.png',
  }
}).then(result => {
  console.log(JSON.stringify(result.filesUploaded))
})

Storing to GCS with the file picker

client.pick({
  storeTo: {
    location: 'gcs',
    path: '/myfiles/1234.png',
  }
}).then(result => {
  console.log(JSON.stringify(result.filesUploaded))
})

Note that Azure and GCS require custom plans while Direct S3 is available to users with starting applications.  S3 is the Filestack default.

While there are of course some platform specific properties, especially for S3, one could easily create a configuration that defines a base “storeTo” object and then sets the common parameters as needed.

For example, assuming the “baseStorageParams” of the “config” object below is set through Inversion of Control (IoC) or some other design pattern, then following code works with any of the three vendors:

var myStorage = config.getBaseStorageParams(); 

//assume "location" and storage specific params
//are preset in the config

myStorage.path = '/myfiles/1234.png';

client.pick({
  storeTo: myStorage
}).then(result => {
  console.log(JSON.stringify(result.filesUploaded))
})

A storage agnostic coding approach

This approach allows you to create code that separates out the concerns of business and procedural logic of the application from some of the more project specific concerns.  And since you’re using Filestack, you know that the underlying compatibility will be maintained for the different storage options and you won’t be spending dev and QA cycles dealing with the nuances of these different platforms.

Learn how to configure Amazon, Azure and Google Storage:

https://www.filestack.com/docs/uploads/storage/#amazon-s3

https://www.filestack.com/docs/uploads/storage/#azure

https://www.filestack.com/docs/uploads/storage/#google-cloud-storage

Exit mobile version