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
demandé il y a 9 mois2796 vues
1 réponse
1
Réponse acceptée

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
EXPERT
répondu il y a 9 mois
profile picture
EXPERT
vérifié il y a 7 mois
  • 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.

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions