Overview
This tutorial will show you how to deploy a Rails application to AWS.
There are a number of ways this task could be tackled. It can be done manually or it can be done using an infrastructure-as-code approach, with a tool like Ansible.
This tutorial shows how to deploy Rails to AWS manually.
I wouldn’t recommend using a manual setup like this for a production Rails project, although I do recommend the experience of going through this manual process for the sake of learning what’s involved. It’s also find to start out hosting an application this way because it’s easy enough to migrate later to a more sophisticated hosting setup.
Before you dive in, be forewarned: it’s kind of a monster of a task. There are a large number of steps involved, many of them tricky and error-prone. Be prepared for the full process to involve hours or even days of potentially frustrating work.
Contents
The size of the setup process makes it impractical to put everything into one post, so each step is its own post.
- Launch EC2 instance
- Install nginx and Passenger
- Add the Rails application to the nginx server
- Set up secrets
- Create RDS database
Don’t be discouraged if not everything works on the first try. It most likely won’t. My advice if something goes wrong is to just blow everything away and start again from the beginning. I find that that approach is, paradoxically, often the fastest.
Good luck!
Thank you so much for this article. I followed your instructions and it worked beautifully!
very straight-forward and detailed tutorial, many thanks! Worked great for me