How to Create and Connect to an RDS Database (MySQL/PostgreSQL)

Amazon RDS (Relational Database Service) allows you to set up, operate, and scale a relational database in the cloud. In this tutorial, you’ll learn how to launch a MySQL or PostgreSQL database and connect to it from your local machine or an EC2 instance.


Step 1: Go to the RDS Dashboard

  1. Sign in to the AWS Console.
  2. In the search bar, type and select RDS.
  3. Click on “Create database”.

📸 [Insert image: RDS dashboard + Create database button]


Step 2: Configure Database Settings

1. Database creation method

  • Choose Standard create

2. Engine options

  • Select MySQL or PostgreSQL

3. Version

  • Choose the latest available version (recommended)

4. Templates

  • Select Free tier (if eligible)

5. DB instance identifier

  • Example: mydb-instance

6. Master username & password

  • Username: admin
  • Set a strong master password

📸 [Insert image: Engine and DB instance configuration]


Step 3: Configure DB Instance

1. DB instance class

  • Choose: db.t3.micro (Free Tier)

2. Storage

  • Allocate 20 GB (default is fine)

📸 [Insert image: Instance type and storage selection]


Step 4: Connectivity Settings

1. VPC

  • Use default VPC (recommended for beginners)

2. Public access

  • Choose Yes to allow connections from outside AWS
    (be cautious for production)

3. VPC security group

  • Select existing or create a new security group that allows:
    • Port 3306 (MySQL)
    • Port 5432 (PostgreSQL)
    • Access from your IP

📸 [Insert image: Connectivity and security group settings]


Step 5: Launch the Database

  1. Review all your settings.
  2. Click Create database.
  3. Wait a few minutes until the status = Available.

📸 [Insert image: Database creating and Available status]


Step 6: Connect to Your Database

1. Find the Endpoint

  • Go to your RDS instance dashboard.
  • Copy the endpoint and port number.

📸 [Insert image: RDS endpoint screen]


2. Connect from Local Machine (CLI or GUI)

🔹 MySQL Example (CLI):

bashCopiarEditarmysql -h your-endpoint.rds.amazonaws.com -u admin -p

🔹 PostgreSQL Example (CLI):

bashCopiarEditarpsql -h your-endpoint.rds.amazonaws.com -U admin -d postgres

🔹 GUI Tools:

You can also use:

  • MySQL Workbench (for MySQL)
  • pgAdmin or DBeaver (for PostgreSQL or any DB)

📸 [Insert image: DB connection in GUI tool]

You May Have Missed