How to get to mysql prompt using CloudShell

0

AWS newbie here. I’ve setup an AWS MySQL RDS. Now … How do I get to the mysql prompt using CloudShell? I mean it seems like it should be easy to do right? 🤔 Also, can I import my mysqldump.sql file from the CloudShell terminal? Thanks for any insight!

profile picture
dbob
已提问 9 个月前2798 查看次数
1 回答
1
已接受的回答

Hello.
As described in the following document, private resources in a VPC cannot be accessed by CloudShell.
https://aws.amazon.com/jp/cloudshell/faqs/

Q: Can I access resources in a VPC with CloudShell?

No, you cannot currently access resources that are in your private VPC in this release of CloudShell.

One way to access RDS publicly from CloudShell is to configure RDS to allow public access.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html#USER_VPC.Hiding

You can check the public IP address by executing the following command in CloudShell.
Set this IP address to be allowed in the RDS security group.

curl ifconfig.io

After that, it can be accessed from CloudShell by setting RDS to allow public access.
However, the IP address of CloudShell is not fixed, so if the IP address is changed, the RDS security group must also be modified.

The other way is to launch an EC2 in the same VPC as the RDS and set it up so that the EC2 can connect to the RDS.
You can connect to that EC2 using Systems Manager's Session Manager, for example.
Doing so allows connection to RDS using SSM's port forwarding feature, as shown in the following document.
https://aws.amazon.com/jp/blogs/mt/use-port-forwarding-in-aws-systems-manager-session-manager-to-connect-to-remote-hosts/

profile picture
专家
已回答 9 个月前
profile picture
专家
已审核 7 个月前
  • Thanks for your answer … but i need to keep the database private. Seems nuts that the CloudShell running in the VPC instance that contains the database can’t access it. Ugh. Thanks again!

  • Updated answers.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则