我有一个RDS实例(MySQL)和一个EC2实例(Spring )。
在本地,我的Spring应用程序在RDS.中正确地建立到我的数据库的连接。
但是当我在EC2中安装Spring应用程序时,应用程序试图连接到RDS (MySQL)中的数据库。但是它把这个错误扔到我身上:
SQLCODE: 0 SQLSTATE: 08S01 TRACE: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
在EC2中,我让这个安全组入站
和出外
发布于 2020-06-26 18:15:11
这听起来很奇怪;因为如果您的本地膝上型计算机是在公共IP地址上工作的,那么它也应该在AWS环境中工作。无论如何,对于连接,您不需要只检查EC2的安全组,还需要检查RDS的安全组,因为RDS也应该允许来自EC2的安全组。虽然异常看起来不像连接/安全组问题。
我觉得这和你的申请有关。
https://stackoverflow.com/questions/62604298
复制