Search code examples
sshamazon-aurorassh-tunnel

SSH Tunnel into Aurora DB via the CLI


Is there a simple step by step example on how to SSH into a private Aurora MySQL db?

something like:

mysql -h dbDomain.pair.com -u dbUser -p dbName

Solution

  • I think you are looking for how to config RDS to be remote accessible, if that's the case, check this https://aws.amazon.com/premiumsupport/knowledge-center/aurora-private-public-endpoints/

    For me I wouldn't make my db access via public endpoints, instead, I would setup as private and only can access from my VPC LAN.

    Then I use a EC2 instance as proxy, and access the database via LAN ip from SSH tunnel.

    To do that, you need check the VPC document, setup subnets etc.

    AWS document is a good place to start.

    https://docs.amazonaws.cn/en_us/vpc/latest/userguide/what-is-amazon-vpc.html

    Update: if you already set the db to be private, take a look at this https://linuxize.com/post/mysql-ssh-tunnel/