I have created a VPC. And inside that vpc in same subnet there are two ec2 instances. There is a deployed application on the first one and on the second one there is installed mysql. I have set up the application to connect to the instance with the installed db but with no success. I will copy the security groups configuration and the db configuration. How to make both of these two instance communicate and the application from the first instance start using the db on the second. Both of them have public ip and can ping each other.
DB connection
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto=update
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://some_ip:3306/demo
spring.datasource.username=root
spring.datasource.password=root
Security groups There are two security groups and both of the are assign to every ec2 instance.
The added id is the ID of this group.
In your security group you are not allowing port 3306 which the database needs to communicate over.
Install mysql-client on your app server you can use the cli to see if you can connect to the database MySQL server using:
mysql -h mysql://some_ip -u root
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.