Related to connecting to Amazon Web Services RDS (mysql) in Rails

Asked 2 years ago, Updated 2 years ago, 52 views

First of all, what I know about Rails DB is that sqlite is used.

Regarding DB, I felt like it would be overwhelming with sqlite after launching an actual service.

Working with the Web Server-Application Server (Nginx + Passenger)

I want to change DB work to mysql.

I'm asking you this question because I don't have a clue about the overall work process.

First of all, I found the posting on the instance where Ruby and Rails are installed

Instead of sqlite, they installed mysql by themselves

In my case, AWS provides services related to DB

You want to use Relational Database Services (RDS), a relational database service.

In the case of this RDS, it seems to be linked outside the EC2 instance where Rails, Ruby, etc. are installed.

Then, how can I change the settings of the Rails installed in the EC2 instance?

For example, as soon as you enter a Gem file, annotate sqlite, and install mysql bundle,

Can you link the EC2 instance with the RDS?

ruby-on-rails aws mysql

2022-09-22 16:59

2 Answers

Development and production are called stages. Usually, development is used for development, and production is used for real service. As the service grows, alpha, beta, etc. will be added separately.

When developing it, it is convenient to install and use mysql on your PC, so you can do it like the example, and when you turn the service, you can add it to the production setting. If the DB is external, such as RDS, you can assign the RDS domain to host.

development:&default
  adapter: mysql2
  encoding: utf8
  database: test_development
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

production: &production
  <<: *default
  host: xxxxxxxxxxxxxxxxxxxx.rds.amazonaws.com
  username: 
  password: 
  database: test_production


2022-09-22 16:59

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.