SSH隧道通过CLI连接到Aurora数据库

huangapple go评论65阅读模式
英文:

SSH Tunnel into Aurora DB via the CLI

问题

有没有一个简单的逐步示例来说明如何通过SSH连接到私有的Aurora MySQL数据库?

像这样的:

mysql -h dbDomain.pair.com -u dbUser -p dbName
英文:

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

答案1

得分: 0

我认为您正在寻找如何配置RDS以实现远程访问,如果是这样的话,请查看这个链接:https://aws.amazon.com/premiumsupport/knowledge-center/aurora-private-public-endpoints/

对于我来说,我不会使我的数据库通过公共端点访问,而是将其设置为私有,只能从我的VPC局域网访问。

然后,我会使用一个EC2实例作为代理,通过SSH隧道从LAN IP访问数据库。

要做到这一点,您需要查看VPC文档,设置子网等。

AWS文档是一个很好的起点。

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

更新:如果您已经将数据库设置为私有,请查看这个链接:
https://linuxize.com/post/mysql-ssh-tunnel/

英文:

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/

huangapple
  • 本文由 发表于 2023年2月9日 00:05:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/75388537.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定