Building web applications with Rails is fast. We can speed it up, even more, using AWS services that perfectly complement the features we plan to develop. What’s more, AWS provides an API for all services and ships it with the Ruby gem that we can use immediately.
Recently, we have been building an exchange data application for telcos. Our MVP was delivered much faster thanks to using AWS services, allowing us to show the client the outcome sooner. In this article, I will give you some ideas on how to employ AWS services in your application to build it faster and provide a better user experience.
Incorporating AWS services into a Rails application
You don’t have to build the whole application using the AWS cloud. If Ruby on Rails is your preferred framework, you can easily incorporate a single AWS service. Even one service will save you some time and help you reach the desired outcome faster. We recently used the following services to build the MVP version more quickly than ever.
AWS Cognito lets you smoothly build authentication mechanisms for your users. With a few more lines of code, you can also enable multi-factor authentication using the mobile phone number of an application like Google Authenticator.
If you want to allow users to authenticate with their Google or Apple accounts, it’s also possible and doesn’t require a lot of configuration.
AWS Transfer Family
AWS Transfer Family is a perfect choice if you’re looking for a file transfer solution that will be intuitive for your clients and easy to handle for your application. It enables you to create FTP, FTPS and SFTP accounts programmatically and automatically transfer uploaded files to your S3 bucket.
Creating an account is as easy as calling the API endpoint with the folder name as a parameter. You can then pass the credentials to your client and expect files to be delivered to S3 once they move them to their folder. Uploading bigger files to S3 may be more complex as it requires breaking them into smaller batches, still Transfer Family will handle the transfers just fine.
AWS S3 is well-known file storage in a key-value format. The service is integrated with Transfer Family, however, you can also use it as a storage driver for your Action Storage feature in a Rails application.
Most of the Ruby gems for uploading files already provide the S3 option. All you have to do is to generate proper credentials, store them in a safe place, and refer to them inside your Rails application.
Lambda is a serverless technology which means that you don’t need to worry about the server or its configuration. You only deliver the Ruby code that will be executed when a lambda function is invoked.
You can call a lambda function to notify your application automatically when a new file is uploaded to the bucket on S3. For example, we implemented Lambda along with S3 and Transfer Family, and such a connection helped us to build a fully automated solution for uploading and processing files.
RDS or Relational Database System is a database hosting service. It takes away the burden of maintenance and software upgrades.
RDS allows to spin up a new database in minutes and plan the backup procedure. Using it with a Rails application is simply a matter of putting the database URL, username, and password in your database configuration file.
AWS Elastic Beanstalk
Elastic Beanstalk will help you to deploy your application to the AWS Cloud and connect all necessary services. It handles the deployment process for you while giving you the flexibility of managing all the resources, as you set them up yourself.
Elastic Beanstalk is a real-time-saver, and it costs nothing – you only pay for the resources it provisions.
Design the code for AWS Cloud
We always follow a few design and coding practices to make the cooperation with AWS Cloud safer and smoother. You can follow them to benefit even more from the connection of cloud computing and the Ruby on Rails framework.
- Don’t reinvent the wheel – use the Ruby gem provided by AWS. It covers all you need to connect your Rails application with any available AWS Services, from copying files to the S3 bucket to provisioning EC2 instances programmatically.
- Manage the minimum level of permissions – use the AWS IAM service to control permissions, and create groups and users. Always give only the minimum credentials needed to execute a given action within a given service. Store the keys in a safe place.
- Design for the cloud – when planning the design of a Rails application, take into account the features that AWS provides. It will help you reduce the amount of code needed to bootstrap your Rails app.
- Always question the cloud usage – sometimes it’s faster and cheaper to write code by hand instead of configuring and paying for yet another service. Be aware of the benefits of the cloud, but push yourself to use it when it doesn’t make sense in the long term.
If you are curious about what costs AWS generates compared to the development of the features, you can use the Cost Explorer service. It shows usage reports for all services that you are using.
Building MVPs with Rails is fast, but the connection with AWS Cloud is even quicker and provides instant access to many features, that can take days or weeks to develop on your own.
If you’re looking to streamline your delivery process or enhance UX, let’s build your next Rails app with AWS services together. Let’s talk!
Chief Technology Officer
Open source fan and growth seeker with over a decade of experience in writing for both human beings and computers. I connect the dots to create high-quality software, valuable relations with people and businesses.