Using Cloud Storages With Rails Applications

Cloud computing is being increasingly frequently put to use for the deployment of software products. It gives organizations an opportunity to rapidly launch new solutions and develop them for the sake of satisfying their business needs. In turn, cloud storages, distributed throughout the network servers, are rented by various companies and are used as kind of depositories for digital data. This is done in order not to purchase and configure the server equipment on one’s own, as well as to gain an ability to flexibly develop the computing power as stress load for an application increases.

As for Ruby on Rails, the apps created on it can be deployed via such cloud platforms as Heroku, Microsoft Azure, and Amazon Web Services S3 – all dedicated, in this case, to storing user downloads. In particular, developers employ certain Ruby gems for cloud storage integration in their Rails application in order to connect to the listed platforms.

This article’s purpose is to tell you in detail why it is worth using cloud storage in Rails apps, and which particular storages are worth paying attention to more than others.

Technical aspect of using cloud storage – what do they do?

Cloud storage, being ‘attached’ to certain web applications, allow for storing colossal volumes of data in various formats. They let one manage the data (with the goal of transferring it to app users) via HTTP and HTTPS protocols. The ultimate advantages here, as opposed to storages located on physical servers, are a high level of accessibility and fail-safety. The latter is achieved by duplicating data in several network nodes, which are distributed throughout the network and physically remote from one another, at once.

Thus, even if several nodes fail, the data will still be delivered to its destination because the required data package can travel the network through the connected graph (i.e. the graph, any two tops of which can be connected in one seamless way).

Advantages of cloud storage

Now let’s figure out what advantages a Ruby-based project owner gets by deploying it with the help of cloud storage.

  • Total accessibility. As we have mentioned above, all the data stored in a cloud is duplicated during the transfer through the network, providing almost 100% guarantee of it being delivered to the end user. This doesn’t only affect the availability of Rails solutions created in cloud. As a matter of fact, at the expense of third-party memory resources expenditure, the stress load on a company’s own networking powers is significantly decreased. This means that even during simultaneous usage of an app or website built with RoR by tens of thousands of users, your network nodes won’t struggle with the traffic and the software solution itself will not fail due to server overload.
  • Accelerated data transfer. In practice, 9 out of 10 providers of the discussed service allow their customers to employ CDN as an additional service. CDN is a type of network that can be a perfect solution for the RoR-based websites directed at the immediate update regardless of the user geolocation (we are talking about, first of all, the news and interactive websites with TA scattered around the various countries of the world).
  • Ability to build fully customizable websites. Currently, virtually all online business owners strive to create easily-customizable solutions that will not require too much effort from web developers each time the need for a certain customization appears. In turn, using cloud storage with Ruby can significantly simplify the procedure of website deployment throughout several servers at once (web developers can move all the static data from web pages to servers), which is incredibly convenient during scaling.
  • Boosted performance. Slow rendering is definitely one of the main problems of modern web development that makes users switch the lagging sites for others. The thing is that most existing websites nowadays are rich with stress-loading animation and various interactive elements that hinder the load and automatic page-refresh significantly. The more dynamic content there is on the website, the more problematic it is to make the resource perform smoothly. Using cloud storage on Ruby on Rails app, however, you can accelerate the processes by creating several simultaneous connections (one for each subdomain).
  • Cheaper deployment of Ruby on Rails software solutions. We’ve already said this, but it is much cheaper to deploy software via cloud servers instead of your own servers (the greater volumes of data you need to store, the more optimal it is to turn to cloud storage service providers).  

Using cloud storage with Ruby: reviewing the best solutions

Web developers use the following solutions as platforms for providing cloud services most frequently:

Amazon Web Services S3

Amazon S3, with ‘S3’ abbreviation standing for Simple Storage Service, offers RoR-developers a myriad of capabilities for uploading and storing various types of data of various volumes (up to several terabytes). Notice that S3 can be used without any additional Amazon services separately, which makes the deployment procedure faster and cheaper. Moreover, Amazon S3 is among the providers that also offer the CDN (which allows sending files to website users based on their location) implementation as a bonus service. The main attribute of this cloud service is a special Reduced Redundancy Storage feature that lets duplication of the transferred data packages for a lesser number of destinations. This lowers the deployment costs (usually cost 25% cheaper).

You can find out how to integrate cloud storage in Ruby app on Github, by the link.

Microsoft Azure

Windows Azure Storage comes as a part of the Windows Azure cloud platform package. A few years ago Azure was preferred over S3 because the Azure Storage’s CDN-networks coverage was more substantial (CDN from S3, for instance, wasn’t available in Russia). Nevertheless, these two services are equally sufficient in that aspect today. This particular discussed solution is primarily preferred for its SDK, which is additionally compatible with third-party clients for working with files and uploading data from cloud (which can be, by the way, presented in the NTFS format).

You can learn more about the Microsoft Azure integration with cloud services here.

Based on Salesforce, Heroku lets developers put less effort into configuring and scaling their web solutions. This platform is all about accessibility. In order to start working with it, you just need to make basic configurations per the simple manual and launch it. Service payments are equal to the volumes of resources expended by the application. This PaaS platform can come in really handy when you need to get as much as possible out of a cloud storage with minimum expenses. This solution would be ideal if an MVP is being tested, insignificant fixes are being made in a readymade software product, the web developers staff is small, and when formidable computational powers aren’t necessary.

Now, to finish the list up, we’d like to tell you which two Ruby gems for cloud storage integration are most frequently employed by RoR-developers.

Carrierwave Ruby gem

The Ruby gem for cloud storage services integration called Carrierwave is a solution that provides an utterly simple process of loading data (usually images) from Ruby-based software solutions, including those built with the Ruby on Rails framework. The main feature of this gem is that instead of putting commands for file loading in the code body, you can transfer them to Carrierwave classes. At the same time, you’ll stick to the general RoR conception – create clean, reusable code.

Fog Ruby gem

The library of cloud services Fog allows use of Amazon S3 for loading and storing files. Additionally, this gem can be used for the simultaneous management of several cloud services via single API. Such an approach allows making an app more ‘lightweight’ and simplifies the server transfer procedure.


As we can see, by using cloud storage, small and average business organizations can rapidly, cheaply and efficiently deploy applications that operate with large volumes of data. They require minimal technical support (as opposed to the storages located on ordinary physical servers) and the ‘rent’ prices are much more modest compared to buying and maintaining physical servers.

Posted by Contributor