Skip to content

Sample development environment for connecting to Aurora MySQL with row-based binary logging enabled via an SSH tunnel.

Notifications You must be signed in to change notification settings

jmbrooks/terraform-aurora-ssh-tunnel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform: Aurora MySQL with SSH Tunnel

This directory contains code to deploy an Aurora MySQL cluster and an SSH tunnel. This is to simulate a pseudo-production environment. We set a cluster parameter group with row-based binary logging on the Aurora MySQL instance in order to test row-base replication.

This is not meant for production use, just for testing with Aurora MySQL through an SSH tunnel.

Features

The terraform will:

  1. Create new Aurora MySQL instance with one writer and reader.
  2. Create a Bastion host SSH tunnel for connecting to the cluster.
  3. Output cluster and bastion endpoints and login details.

Once created, you'll need to download the EC2 key pair so you can use the PEM file to access the SSH tunnel. To connect to the database through the SSH tunnel, run the following command with your corresponding variables:

ssh -N -L {localPort}:{rdsHost}:{remotePort} {user}@{remoteHost} -i {~/path/to/key}

Note: localPort can be any non-used port you set (I use 3307); {user} for AWS is 'ec2-user'.

Example:

ssh -N -L 3307:cluster-sample.some_cluster24346.us-east-2.rds.amazonaws.com:3306 [email protected] -i ~/Downloads/my_key.pem

About

Sample development environment for connecting to Aurora MySQL with row-based binary logging enabled via an SSH tunnel.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages