LoginSignup
1
0

More than 5 years have passed since last update.

Sequelなどの外部ツールからRDSへ接続する

Last updated at Posted at 2017-06-20

概要

Sequelなどの外部ツールからRDSへ接続して中身を見れるようにしたい。

前提

RDS構築済み

RDSのパブリックアクセスを許可する

設定を確認

RDS -> インスタンス -> インスタンスの操作 -> 詳細を表示
パブリックアクセス可能 はい
になって入ればok。

※いいえ になっている場合は変更する。オンラインで変更可能。
RDS -> インスタンス -> インスタンスの操作 -> 変更
すぐに変更 のチェックボックスにチェックを忘れずに。

パブリックアクセスになったことを確認。

 nslookup
> mydb1.xxxxxxx.ap-northeast-1.rds.amazonaws.com

Non-authoritative answer:
Name: mydb1.xxxxxxx.ap-northeast-1.rds.amazonaws.com
Address: 10.0.3.23

↓パブリックなホスト名とグローバルIPアドレスが返ってくるようになった。

 nslookup
> mydb1.xxxxxxx.ap-northeast-1.rds.amazonaws.com

Non-authoritative answer:
xxx-dev.xxxxxxx.ap-northeast-1.rds.amazonaws.com canonical name = ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com.
Name: ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com
Address: xxx.xxx.xxx.xxx

セキュリティグループの設定

このままだと誰でもアクセスできてしまうので、セキュリティグループの設定をします。

タイプ プロトコル ポート範囲 ソース
MYSQL/Aurora TCP 3306 マイIP(任意)

Sequelから接続してみる

スクリーンショット 2017-06-20 14.21.57.png
ホスト名はRDS -> インスタンス -> インスタンスの操作 -> 詳細を表示 -> エンドポイント を設定

ReadOnlyなユーザーを追加する(必要あれば)

GRANT SELECT ON `%`.* TO read_only@`%` identified by 'read_only_pass';
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0