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.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ