Here are my shell commands and output.
voclabs:~/environment aws rds describe-db-instances --db-instance-identifier de-c1w2-rds --output text --query "DBInstances[].Endpoint.Address"
de-c1w2-rds.c38cu6sc4d5b.us-east-1.rds.amazonaws.com
voclabs:~/environment mysql --host=de-c1w2-rds.c38cu6sc4d5b.us-east-1.rds.amazonaws.com --user=admin --password=adminpwrd --port=3306
ERROR 2002 (HY000): Can’t connect to MySQL server on ‘de-c1w2-rds.c38cu6sc4d5b.us-east-1.rds.amazonaws.com’ (115)
Hello @toliu
I tried the lab, and the command is working fine on my side. These are the things that come to my mind that you can try:
Please, make sure that you have run the command source scripts/setup.sh before going through the C1_W2_Assignment.md file.
Make sure you are choosing the correct subnet for your Cloud9 environment. Choosing a wrong subnet always lead to connection issues since endpoints in different subnets are not able to communicate with each other.
In the AWS console, search for RDS and open the RDS panel. From the menu on the left, choose Databases. There you should see the MySQL database and its status. Please, confirm that it is working like the screenshot below. The status should be Available.
Hello thanks for the information, I have the problem with the endpoint, I follow your steps but I still get the message in the terminal “no such file or directory” I am trying to do the step 2.1 and 2.2
In step 2.1, did you replace <MySQL-DB-name> with de-c1w2-rds? Perhaps you can share a screenshot of the line of code you ran in step 2.1 so we can help troubleshoot?
Hi @LuiferG_AI , I can see from your screenshot that you are trying to run the right command. Would you be able to double check that you used the specified configurations when setting up your Cloud9 environment? Let me know if you still run into this issue.
Hi @LuiferG_AI and @EduardoIslas
I couldn’t reproduce the problem. My best guess is that in your cases the problem is with the subnet you have chosen for your Cloud9 environment. Please, make sure that you choose de-c1w2-public-subnet when creating the Cloud9 environment.
I have the same issue (bash: de-c1w2-rds: No such file or directory) and the solution that worked for LuiferG_AI does not work for me. I get another error: Bad value for --query “DBInstances[?DBInstanceIdentifier==‘de-c1w2-rds’].Endpoint.Address”: Bad jmespath expression: Unknown token “:
“DBInstances[?DBInstanceIdentifier==‘de-c1w2-rds’].Endpoint.Address”
^
Hi @LuiferG_AI, it’s very interesting that you were able to get the database host using the command: aws rds describe-db-instances --query “DBInstances[?DBInstanceIdentifier==‘de-c1w2-rds’].Endpoint.Address” --output text
I just tried the lab and that didn’t work for me, but the original command outlined in the lab instructions did work. I’ll let the engineering team know about this just so that they are aware. I’m glad you were able to complete the lab with this workaround!
Hi @EduardoIslas , for each labs, we only give learners the access they need to complete the lab. So don’t worry about the access denied message on the AWS management console home page, you will see similar messages in other labs as well.
Hi @Samuel_Andaluz , I got the same error as you when I tried to run the “work-around” command. However, I can confirm that the command from the assignment instructions worked for me.
As you can see from section 3 of the assignment instructions, the RDS database is hosted in a private subnet. So we need to ensure that we are set up in the same VPC in order to access this database.