How to build a Ruby on Rails app on AWS for beginners – Part 2.

Now it is time to provision our database. We are going to go with Postgres.

There are 2 ways to do this on AWS, we can either install Postgres into our ec2 Linux host, or we can provision the database separately in AWS LightSail as a PaaS RDS databas…


This content originally appeared on DEV Community and was authored by Lee Wynne

Now it is time to provision our database. We are going to go with Postgres.

There are 2 ways to do this on AWS, we can either install Postgres into our ec2 Linux host, or we can provision the database separately in AWS LightSail as a PaaS RDS database.

In this example we are just going to install Postgres locally on our LightSail ec2 instance.

This is a fairly simple process, first of lets install a recent version of Postgres.

sudo apt install postgresql-11 libpq-dev

Next up we we are going to setup our DB user.

sudo -u postgres createuser lee -s

# If you would like to set a password for the user, you can do the following

sudo -u postgres psql 
postgres=# \password lee

That's it for installing and setting up PostGres within an EC2 instances.

Let's give this a whirl by creating your first Rails App.

rails new mynewrailsapp -d postgresql
cd mynewrailsapp
rails db:create
rails server

Visit http://localhost:3000 to view your new rails app

That should be it, you can then go ahead and create some of your models and migrations and start building your dreams.


This content originally appeared on DEV Community and was authored by Lee Wynne


Print Share Comment Cite Upload Translate Updates
APA

Lee Wynne | Sciencx (2021-06-29T14:34:31+00:00) How to build a Ruby on Rails app on AWS for beginners – Part 2.. Retrieved from https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-2/

MLA
" » How to build a Ruby on Rails app on AWS for beginners – Part 2.." Lee Wynne | Sciencx - Tuesday June 29, 2021, https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-2/
HARVARD
Lee Wynne | Sciencx Tuesday June 29, 2021 » How to build a Ruby on Rails app on AWS for beginners – Part 2.., viewed ,<https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-2/>
VANCOUVER
Lee Wynne | Sciencx - » How to build a Ruby on Rails app on AWS for beginners – Part 2.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-2/
CHICAGO
" » How to build a Ruby on Rails app on AWS for beginners – Part 2.." Lee Wynne | Sciencx - Accessed . https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-2/
IEEE
" » How to build a Ruby on Rails app on AWS for beginners – Part 2.." Lee Wynne | Sciencx [Online]. Available: https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-2/. [Accessed: ]
rf:citation
» How to build a Ruby on Rails app on AWS for beginners – Part 2. | Lee Wynne | Sciencx | https://www.scien.cx/2021/06/29/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.