Connecting to AWS RDS Databases¶
Connect securely to Amazon RDS databases through EC2 bastion hosts using AWS Session Manager.
Overview¶
StormTunnel supports secure connections to AWS RDS databases (MySQL, PostgreSQL, Aurora, and more) through EC2 bastion hosts. This eliminates the need to expose your database to the public internet or manage SSH keys.
How It Works¶
- StormTunnel creates a secure tunnel through an EC2 instance
- The EC2 instance forwards traffic to your RDS database
- You connect to
localhoston your Mac as if the database were local
Prerequisites¶
Before connecting to RDS:
- EC2 Bastion Host - An EC2 instance in the same VPC as your RDS database
- Network Access - The EC2 instance must be able to reach the RDS endpoint
- AWS Credentials - Configured on your Mac with SSM permissions
- RDS Endpoint - Your database endpoint (from the RDS console)
Creating an RDS Tunnel¶
Step 1: Get Your RDS Endpoint¶
- Open the AWS Console → RDS
- Select your database
- Copy the Endpoint (e.g.,
mydb.abc123xyz.us-east-1.rds.amazonaws.com) - Note the Port (MySQL: 3306, PostgreSQL: 5432)
Step 2: Create the Tunnel¶
- Click + in StormTunnel
- Select Tunnel Type: AWS Session Manager
- Configure:
| Field | Value | Example |
|---|---|---|
| Name | Descriptive name | Production MySQL |
| EC2 Instance ID | Your bastion host | i-0abc123def456 |
| AWS Profile | Your AWS profile | production |
| AWS Region | RDS region | us-east-1 |
| Local Port | Port on your Mac | 3306 |
| Remote Host | RDS endpoint | mydb.abc123xyz.us-east-1.rds.amazonaws.com |
| Target Port | Database port | 3306 |
- Click Save
Step 3: Connect¶
- Toggle the tunnel On
- Connect using your database client:
MySQL:
PostgreSQL:
Database-Specific Examples¶
MySQL / MariaDB¶
Name: Production MySQL
Remote Host: myapp-db.abc123.us-east-1.rds.amazonaws.com
Local Port: 3306
Target Port: 3306
Connect with:
Or use MySQL Workbench:
- Host:
127.0.0.1 - Port:
3306 - Username: Your RDS username
PostgreSQL¶
Name: Analytics PostgreSQL
Remote Host: analytics-db.xyz789.eu-west-1.rds.amazonaws.com
Local Port: 5432
Target Port: 5432
Connect with:
Or use TablePlus, DBeaver, or pgAdmin:
- Host:
localhost - Port:
5432
Aurora MySQL¶
Name: Aurora Cluster
Remote Host: my-cluster.cluster-abc123.us-west-2.rds.amazonaws.com
Local Port: 3306
Target Port: 3306
Aurora Endpoints
Use the cluster endpoint for read-write operations or the reader endpoint for read-only queries.
Aurora PostgreSQL¶
Name: Aurora PostgreSQL
Remote Host: aurora-pg.cluster-xyz789.us-east-1.rds.amazonaws.com
Local Port: 5432
Target Port: 5432
Multiple Database Connections¶
You can create multiple tunnels to access different databases simultaneously. Use different local ports to avoid conflicts:
| Database | Local Port | Remote Port |
|---|---|---|
| Production MySQL | 3306 | 3306 |
| Staging MySQL | 3307 | 3306 |
| Analytics PostgreSQL | 5432 | 5432 |
| Reporting PostgreSQL | 5433 | 5432 |
Troubleshooting¶
"Connection refused" Error¶
Cause: The tunnel isn't active or the RDS endpoint is incorrect.
Solution:
- Verify the tunnel is toggled On (green indicator)
- Check the RDS endpoint is correct (copy from AWS Console)
- Confirm the port matches your database type
"Access denied" Error¶
Cause: Database credentials are incorrect or IAM permissions are missing.
Solution:
- Verify your database username and password
- Ask your DBA to confirm your user has access from the bastion host IP
- Check RDS security group allows connections from the EC2 instance
"Host not found" Error¶
Cause: The EC2 instance cannot reach the RDS endpoint.
Solution:
- Verify the EC2 instance is in the same VPC as RDS
- Check security groups allow traffic on the database port
- Confirm VPC routing allows private subnet communication
Timeout Errors¶
Cause: Network connectivity issues or security group blocks.
Solution:
- Ask your AWS admin to verify:
- RDS security group inbound rules
- EC2 security group outbound rules
- VPC routing tables
- Network ACLs
Security Best Practices¶
- Use IAM Authentication when possible for RDS
- Limit bastion access - Only grant SSM permissions to users who need database access
- Rotate credentials regularly
- Use separate profiles for production and non-production environments
- Close tunnels when not in use
Need Help?¶
- Ask your AWS administrator for RDS endpoint and credentials
- See AWS Session Manager for SSM setup
- See Troubleshooting Guide for more issues
Related Topics: