简体   繁体   中英

MySQL Connection error in RDS database AWS amazon - Security Group Problem

i have a connection problem with php in a web server with apache2 and a mariadb database in a VPS.

In the database exist 3 security group:

  • Home - My IP/32
  • MyVPS - Elastic Ip of VPC instance/32
  • AllTraffic - 0.0.0.0/0

(All with port range: 3306, 80)

With this security groups the connection between WebServer - Database is okey. For security i want that access to the database be only for Home and MyVps.

But when i tryng delete "AllTraffic" security group, the connection of my WebServer in the VPS to the database is lost. The connection of my local WebServer to database is okey.

I think that the problem is in the security group "MyVps". At present, the ip is a elastic ip, the same that i use to access to WebServer from the browser.

Software

  • Linux instance in EC2 amazon
  • Mariadb database RDS amazon associated with the previous.
  • 3 Security Group associated with the first.
  • apache local web server.
  • apache webserver in the first.

Is your RDS instance, and/or EC2 instance in a VPC? If so the connection to your RDS from the EC2 instance could be over the private IP address, not the public Elastic IP.

Instead of granting access to the Elastic IP I would probably grant access to the security group your EC2 instance uses instead.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM